The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
5.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_PROCESS_JUCEHEADER__
  19. #define __JUCE_PROCESS_JUCEHEADER__
  20. #include "../text/juce_String.h"
  21. //==============================================================================
  22. /** Represents the current executable's process.
  23. This contains methods for controlling the current application at the
  24. process-level.
  25. @see Thread, JUCEApplication
  26. */
  27. class JUCE_API Process
  28. {
  29. public:
  30. //==============================================================================
  31. enum ProcessPriority
  32. {
  33. LowPriority = 0,
  34. NormalPriority = 1,
  35. HighPriority = 2,
  36. RealtimePriority = 3
  37. };
  38. /** Changes the current process's priority.
  39. @param priority the process priority, where
  40. 0=low, 1=normal, 2=high, 3=realtime
  41. */
  42. static void setPriority (const ProcessPriority priority);
  43. /** Kills the current process immediately.
  44. This is an emergency process terminator that kills the application
  45. immediately - it's intended only for use only when something goes
  46. horribly wrong.
  47. @see JUCEApplication::quit
  48. */
  49. static void terminate();
  50. //==============================================================================
  51. /** Returns true if this application process is the one that the user is
  52. currently using.
  53. */
  54. static bool isForegroundProcess();
  55. //==============================================================================
  56. /** Raises the current process's privilege level.
  57. Does nothing if this isn't supported by the current OS, or if process
  58. privilege level is fixed.
  59. */
  60. static void raisePrivilege();
  61. /** Lowers the current process's privilege level.
  62. Does nothing if this isn't supported by the current OS, or if process
  63. privilege level is fixed.
  64. */
  65. static void lowerPrivilege();
  66. //==============================================================================
  67. /** Returns true if this process is being hosted by a debugger.
  68. */
  69. static bool JUCE_CALLTYPE isRunningUnderDebugger();
  70. //==============================================================================
  71. /** Tries to launch the OS's default reader application for a given file or URL. */
  72. static bool openDocument (const String& documentURL, const String& parameters);
  73. /** Tries to launch the OS's default email application to let the user create a message. */
  74. static bool openEmailWithAttachments (const String& targetEmailAddress,
  75. const String& emailSubject,
  76. const String& bodyText,
  77. const StringArray& filesToAttach);
  78. #if JUCE_WINDOWS || DOXYGEN
  79. //==============================================================================
  80. /** WINDOWS ONLY - This returns the HINSTANCE of the current module.
  81. The return type is a void* to avoid being dependent on windows.h - just cast
  82. it to a HINSTANCE to use it.
  83. In a normal JUCE application, this will be automatically set to the module
  84. handle of the executable.
  85. If you've built a DLL and plan to use any JUCE messaging or windowing classes,
  86. you'll need to make sure you call the setCurrentModuleInstanceHandle()
  87. to provide the correct module handle in your DllMain() function, because
  88. the system relies on the correct instance handle when opening windows.
  89. */
  90. static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() noexcept;
  91. /** WINDOWS ONLY - Sets a new module handle to be used by the library.
  92. The parameter type is a void* to avoid being dependent on windows.h, but it actually
  93. expects a HINSTANCE value.
  94. @see getCurrentModuleInstanceHandle()
  95. */
  96. static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) noexcept;
  97. /** WINDOWS ONLY - Gets the command-line params as a string.
  98. This is needed to avoid unicode problems with the argc type params.
  99. */
  100. static String JUCE_CALLTYPE getCurrentCommandLineParams();
  101. #endif
  102. private:
  103. Process();
  104. JUCE_DECLARE_NON_COPYABLE (Process);
  105. };
  106. #endif // __JUCE_PROCESS_JUCEHEADER__