Function Reference


_WinAPI_CreateProcess

Creates a new process and its primary thread

#include <WinAPIProc.au3>
_WinAPI_CreateProcess ( $sAppName, $sCommand, $tSecurity, $tThread, $bInherit, $iFlags, $pEnviron, $sDir, $tStartupInfo, $tProcess )

Parameters

$sAppName The name of the module to be executed
$sCommand The command line to be executed
$tSecurity a $tagSECURITY_ATTRIBUTES structure or a pointer to it that determines whether the returned handle to the new process can be inherited by child processes.
$tThread a $tagSECURITY_ATTRIBUTES structure or a pointer to it that determines whether the returned handle to the new thread can be inherited by child processes.
$bInherit If True, each inheritable handle in the calling process is inherited by the new process
$iFlags Flags that control the priority class and creation of the process
$pEnviron Pointer to the environment block for the new process
$sDir The full path to the current directory for the process
$tStartupInfo a $tagSTARTUPINFO structure or a pointer to it
$tProcess a $tagPROCESS_INFORMATION structure or a pointer to it
Constants are defined in APIProcConstants.au3

Return Value

Success: True
Failure: False, call _WinAPI_GetLastError() to get extended error information

Related

$tagPROCESS_INFORMATION, $tagSECURITY_ATTRIBUTES, $tagSTARTUPINFO

See Also

Search CreateProcess in MSDN Library.

Example

#include <MsgBoxConstants.au3>
#include <WinAPIMem.au3>
#include <WinAPIProc.au3>
#include <WinAPISys.au3>

Local $tProcess = DllStructCreate($tagPROCESS_INFORMATION)
Local $tStartup = DllStructCreate($tagSTARTUPINFO)
If _WinAPI_CreateProcess('', @SystemDir & '\notepad.exe', 0, 0, 0, $CREATE_NEW_PROCESS_GROUP, 0, 0, $tStartup, $tProcess) Then
        ToolTip("Waiting notepad Closing")
        ProcessWaitClose(DllStructGetData($tProcess, 'ProcessID'))
Else
        _WinAPI_ShowLastError()
EndIf