PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Createprocess problem

Hi,

I am writing a help function for my application and to launch it I use

Code:
CreateProcess(_T("peghelp.exe"), _T("MyHelp.htm"), NULL, NULL, FALSE, 0, NULL, NULL, NULL, π)


this works fine but I'm wondering if I can catch it when someone press the OK button on the top right hand corner of the help screen.

I tried

Code:
GetExitCodeProcess(pi.hProcess, &dwStatus;)
but all it returns to dwStatus is 0 no matter what I do to the help screen.

Can somebody please help ? What did I do wrong ?
Kevin Gelso · 17 Oct 2004, 15:23 UTC
Moved to developers forum. I altered your post to make the code easier to read.
I've done a similar thing on the PC using CreateProcess and WaitForSingleObject.

Code:

DWORD WaitForSingleObject(

HANDLE hHandle, // handle of object to wait for
DWORD dwMilliseconds // time-out interval in milliseconds
);


You give e.g. 100ms as the timeout and check the result. If the result is WAIT_TIMEOUT then the process must still be running, so you continue in a loop until you get something other than WAIT_TIMEOUT.

Not sure if it's the proper way to do it, but it has worked fine on win 98, 2000, and XP.

However, haven't checked PPC help (currently at work PC) - not sure if same thing supported. You'll probably find that because "ok" minimises the process will continue and you'll need to use some other method. Also to get a process handle you'll need to pass in a PROCESS_INFORMATION struct to CreateProcess. Hope that helps.