I'm using CreateProcess() to run the JRE installer and I need to know when the installer finishes. Both GetExitCodeProcess() and GetExitCodeThread crash the program. Here's my code:
Process Creation :
Code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
int res = CreateProcess("c:\\j2re-1_4_2_04-windows-i586-p.exe", 0, 0, 0, 0, 0, 0, 0, &si, &pi);
HANDLE process = pi.hProcess;
Checking for exit: (Part of my default: option for switch in Main Window Procedure)
Code:
LPDWORD exitCode = NULL;
GetExitCodeProcess(process, exitCode);
if(exitCode != (unsigned long *)259)
{
CloseHandle(process);
currentStep = 110;
}