Code: Select all
sCommandLine := ""
VarSetCapacity(pProcessInfo, 24, 0)
sizeofStartupInfo := VarSetCapacity(pStartupInfo, 104, 0)
NumPut(sizeofStartupInfo, pStartupInfo, 0, "UInt")
NumPut(0x00000100, pStartupInfo, 60, "UInt")
DllCall("CreateProcess"
,"UInt", 0 ; ApplicationName
,"Ptr", &sCommandLine ; CommandLine
,"UInt", 0 ; ProcessAttributes
,"UInt", 0 ; ThreadAttributes
,"Int", 1 ; InheritHandles
,"UInt", 0x00000004 ; CreationFlags 0x00000004 = CREATE_SUSPENDED
,"UInt", 0 ; Environment
,"Ptr", &A_ScriptDir ; CurrentDirectory
,"Ptr", &pStartupInfo ; StartupInfo
,"Ptr", &pProcessInfo) ; ProcessInformation
iProcessId := NumGet(pProcessInfo, 16, "UInt")
Process, Wait, %iProcessId%
DllCall("CloseHandle", "Ptr", NumGet(pProcessInfo, 0))
DllCall("CloseHandle", "Ptr", NumGet(pProcessInfo, 8))
Spoiler
It does create the process suspended, however I'm searching for how to "resume" it after some time.And if possible someone could take a look if im calling the CreateProcess "correctly".