CreateProcess
Creates a new process and its primary thread. The new process runs in the security context of the calling process.
Parameters:
lpApplicationName
: The name of the module to be executed.lpCommandLine
: The command line for the executable image.lpProcessAttributes
: Security attributes for the process object.lpThreadAttributes
: Security attributes for the primary thread object.bInheritHandles
: Whether the calling process's handles are inherited.dwCreationFlags
: Flags that control the execution.lpEnvironment
: A pointer to the environment block for the new process.lpCurrentDirectory
: The fully qualified path of the current directory for the process.lpStartupInfo
: A pointer to a STARTUPINFO structure that specifies how to launch the application.lpProcessInformation
: A pointer to a PROCESS_INFORMATION structure that receives identification information about the new process.
Return Value:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError
.
Remarks:
CreateProcess
is a powerful function that allows for extensive customization of process creation. It's important to handle errors correctly by checking the return value and calling GetLastError
.