I am having problems with getting the following code to work in C++ (VC++ console app). It simply doesn't create the process, but it prints out the error text.
static void main(){
char *hotkeyexe = "cmd";
PROCESS_INFORMATION pi;
STARTUPINFO si;
if(!CreateProcess(hotkeyexe, "", 0, 0, 0, 0, 0, 0, &si, &pi))
printf("error");
scanf("%d");
}
}
You need to zero out STARTUPINFO.
ZeroMemory(&si, sizeof(si));