Link to home
Start Free TrialLog in
Avatar of DiGiTaL
DiGiTaL

asked on

Getting the values returned by the executable invoked by createprocess

Hi
     I am invoking an executable using the CreateProcess Api call , i want to check the error code/return values returned by the called executable. I need some help in solving this problem, urgently

thanx in advance
regards
Prasanna
ASKER CERTIFIED SOLUTION
Avatar of Nosfedra
Nosfedra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kocil
Kocil

To make it clear :)

     PROCESS_INFORMATION ProcessInfo;
        DWORD retcode;

        ...
     if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,
          CREATE_NEW_CONSOLE,
          NULL,
          NULL,
          &StartupInfo,
          &ProcessInfo))
     {
          return GetLastError();          
     }

     WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
     if(!GetExitCodeProcess(ProcessInfo.hProcess, &retcode))
          retcode = 0;