bool IsProcRunning(HANDLE hProcess){ DWORD dwExitCode; GetExitCodeProcess(hProcess, &dwExitCode); return (STILL_ACTIVE == dwExitCode);}
Regards Mats
bool IsProcRunning(HANDLE hProcess){ DWORD dwExitCode; GetExitCodeProcess(hProcess, &dwExitCode); return (STILL_ACTIVE == dwExitCode);}
quote:Original post by doctorsixstring
So what am I doing wrong?
quote:
You must pass at least one argument, arg0 or argv[0], to the spawned process. By convention, this argument is the name of the program as you would type it on the command line. A different value does not produce an error.
int result = _spawnlp(_P_WAIT, "setup.exe", "setup.exe", NULL);if (result != 0) // handle errors...
char* args[2];args[0] = "setup.exe";args[1] = NULL;int result = _spawnvp( _P_WAIT, args[0], args);
_spawnlp(_P_WAIT, strSetupDir, strSetupDir, NULL);
STARTUPINFO si;PROCESS_INFORMATION pi;memset(&si, 0, sizeof(STARTUPINFO));si.cb = sizeof(STARTUPINFO); CreateProcess(strFilenameWithPath,NULL,NULL,NULL,FALSE,0,NULL, NULL, &si, π);DWORD dwExitCode = STILL_ACTIVE;while(dwExitCode == STILL_ACTIVE) GetExitCodeProcess( pi.hProcess, &dwExitCode );
DWORD ExecuteCommand(char *strFilenameWithPath, int cmdShow){ int processStarted; DWORD dwExitCode = STILL_ACTIVE; STARTUPINFO si; PROCESS_INFORMATION procinfo; // changed from pi due to html formatting memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = cmdShow; processStarted = CreateProcess(strFilenameWithPath,NULL,NULL,NULL,FALSE,0,NULL, NULL, &si, &procinfo); if ( processStarted == 0 ) { // error! }// while(dwExitCode == STILL_ACTIVE) // this while loop is not the way to do it WaitForSingleObject(procinfo.hProcess, INFINITE); GetExitCodeProcess( procinfo.hProcess, &dwExitCode ); return dwExitCode;}
quote:Original post by doctorsixstring
I was thinking that maybe an InstallShield app launches another file, thus causing my original program to think that the setup is complete.
quote:Original post by doctorsixstring
It seems like InstallShield setup programs are actually multiple executables, with the primary file "setup.exe" launching another setup program. In this case, my program is correct when it sees that "setup.exe" has quit. Is there any way to track processes created by processes that my program creates? I don''t have much hope, but if anyone has a solution, I would be very happy.
-Mike