OpenShot Library | OpenShotAudio  0.2.2
juce_Process.h
1 
2 /** @weakgroup juce_core-threads
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  The code included in this file is provided under the terms of the ISC license
15  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16  To use, copy, modify, and/or distribute this software for any purpose with or
17  without fee is hereby granted provided that the above copyright notice and
18  this permission notice appear in all copies.
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 //==============================================================================
31 /** Represents the current executable's process.
32 
33  This contains methods for controlling the current application at the
34  process-level.
35 
36  @see Thread, JUCEApplicationBase
37 
38  @tags{Core}
39 */
41 {
42 public:
43  //==============================================================================
44  enum ProcessPriority
45  {
46  LowPriority = 0,
47  NormalPriority = 1,
48  HighPriority = 2,
49  RealtimePriority = 3
50  };
51 
52  /** Changes the current process's priority.
53 
54  @param priority the process priority, where
55  0=low, 1=normal, 2=high, 3=realtime
56  */
57  static void JUCE_CALLTYPE setPriority (const ProcessPriority priority);
58 
59  /** Kills the current process immediately.
60 
61  This is an emergency process terminator that kills the application
62  immediately - it's intended only for use only when something goes
63  horribly wrong.
64 
65  @see JUCEApplicationBase::quit
66  */
67  static void JUCE_CALLTYPE terminate();
68 
69  //==============================================================================
70  /** Returns true if this application process is the one that the user is
71  currently using.
72  */
73  static bool JUCE_CALLTYPE isForegroundProcess();
74 
75  /** Attempts to make the current process the active one.
76  (This is not possible on some platforms).
77  */
78  static void JUCE_CALLTYPE makeForegroundProcess();
79 
80  /** Hides the application (on an OS that supports this, e.g. OSX, iOS, Android) */
81  static void JUCE_CALLTYPE hide();
82 
83  //==============================================================================
84  /** Raises the current process's privilege level.
85 
86  Does nothing if this isn't supported by the current OS, or if process
87  privilege level is fixed.
88  */
89  static void JUCE_CALLTYPE raisePrivilege();
90 
91  /** Lowers the current process's privilege level.
92 
93  Does nothing if this isn't supported by the current OS, or if process
94  privilege level is fixed.
95  */
96  static void JUCE_CALLTYPE lowerPrivilege();
97 
98  //==============================================================================
99  /** Returns true if this process is being hosted by a debugger. */
100  static bool JUCE_CALLTYPE isRunningUnderDebugger() noexcept;
101 
102 
103  //==============================================================================
104  /** Tries to launch the OS's default reader application for a given file or URL. */
105  static bool JUCE_CALLTYPE openDocument (const String& documentURL, const String& parameters);
106 
107  /** Tries to launch the OS's default email application to let the user create a message. */
108  static bool JUCE_CALLTYPE openEmailWithAttachments (const String& targetEmailAddress,
109  const String& emailSubject,
110  const String& bodyText,
111  const StringArray& filesToAttach);
112 
113  #if JUCE_WINDOWS || DOXYGEN
114  //==============================================================================
115  /** WINDOWS ONLY - This returns the HINSTANCE of the current module.
116 
117  The return type is a void* to avoid being dependent on windows.h - just cast
118  it to a HINSTANCE to use it.
119 
120  In a normal JUCE application, this will be automatically set to the module
121  handle of the executable.
122 
123  If you've built a DLL and plan to use any JUCE messaging or windowing classes,
124  you'll need to make sure you call the setCurrentModuleInstanceHandle()
125  to provide the correct module handle in your DllMain() function, because
126  the system relies on the correct instance handle when opening windows.
127  */
128  static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() noexcept;
129 
130  /** WINDOWS ONLY - Sets a new module handle to be used by the library.
131 
132  The parameter type is a void* to avoid being dependent on windows.h, but it actually
133  expects a HINSTANCE value.
134 
135  @see getCurrentModuleInstanceHandle()
136  */
137  static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) noexcept;
138  #endif
139 
140  #if (JUCE_MAC && JUCE_MODULE_AVAILABLE_juce_gui_basics) || DOXYGEN
141  //==============================================================================
142  /** OSX ONLY - Shows or hides the OSX dock icon for this app. */
143  static void setDockIconVisible (bool isVisible);
144  #endif
145 
146  #if JUCE_MAC || JUCE_LINUX || DOXYGEN
147  //==============================================================================
148  /** UNIX ONLY - Attempts to use setrlimit to change the maximum number of file
149  handles that the app can open. Pass 0 or less as the parameter to mean
150  'infinite'. Returns true if it succeeds.
151  */
152  static bool setMaxNumberOfFileHandles (int maxNumberOfFiles) noexcept;
153  #endif
154 
155 private:
156  Process();
157  JUCE_DECLARE_NON_COPYABLE (Process)
158 };
159 
160 } // namespace juce
161 
162 /** @}*/
#define JUCE_API
This macro is added to all JUCE public class declarations.
Represents the current executable's process.
Definition: juce_Process.h:40
A special array for holding a list of strings.
The JUCE String class!
Definition: juce_String.h:42