GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Four — Flow Control (continued)
CreateProcessAsElevated Function
Overview
The CreateProcessAsElevated function creates a new process in the primary thread that runs a requested program to be run in an elevated state. This function returns immediately.
Syntax/Parameters
Syntax
handle = CreateProcessAsElevated ( string name, [string parameters], [int showmode] );
Parameters
name
A string containing the name of the program to run. This should generally be a qualified name and path referencing an executable (“exe”) file.
parameters
An optional string that specifies the parameters to be passed to the called program. The parameters and their syntax are dependent on the receiving application. For many applications, placing a filename as a parameter will cause the target program to open and process that file. Note that most applications will treat unquoted text with spaces as multiple parameters and therefore the parameters must be appropriately prepared.
showmode
An optional int specifying the requested mode to show the called application, assuming it is a window. These flags match those in the Windows SDK; for more information, see MSDN. The default is SW_RESTORE.
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the z-order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. The currently active window remains active.
SW_SHOWNA
Displays the window in its current state. The currently active window remains active.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. The currently active window remains active.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
Note that not all programs process this parameter in the same manner and some override its operation depending on the mode requested. For example, Internet Explorer ignores all modes except SW_HIDE.
Return Value
Returns a handle as a process handle or a NULL_HANDLE on failure. Use the GetLastError and GetLastErrorMessage function to retrieve error information.
Remarks
The CreateProcessAsElevated function differs from RunProgramElevated [or ShellExecute] in that a if allowed to run, the caller receives a handle to the process. To wait for the program to close, use the WaitForObject function with the process handle. The return value of the program can also be retrieved with the GetProcessExitCode function.
Note that this is relayed through the Windows API and certain errors, such as find not found, willbe directly reported to the user. As such, this function added to the program, the caller should be careful to avoid errors messages that cannot be controlled directly.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.