Hi,
I'm having a small problem using Create process. I'm trying to run an external program using createProcess(). This is working fine and the program (i'm testing it using calc) is loading ok. Now i want to get hold of the window handle (HWND__*) of the new process in this case calc.
I've tried the following code however it crashes out. Can anyone tell me whats going wrong with the code or another method to retrieve this handle?
FindProgWindow("prog name"); is a methos i have in a DLL. this is simplyCode:STARTUPINFO siStartInfo; PROCESS_INFORMATION piProcessInfo; GetStartupInfo(&siStartInfo); CreateProcess(NULL, "Calc", NULL,NULL,FALSE,0,NULL,NULL,&siStartInfo,&piProcessInfo); AppHook = FindProgWindow("Calculator");
The program breaks out with the messageCode:DllExport HWND__* WINAPI FindProgWindow(CString progName) { return FindWindow(NULL, progName); }
User breakpoint called from code at 0x7c901230
I have also tried replacing FindProgWindow("Calculator"); with FindWindow(NULL, "Calculator"); and this just returns 0.
Any Ideas?
thanks Matt.




Reply With Quote