Closing a application grace fully created by Createprocess()
-
Our Purpose is to Launch an application , once launched and when closed by the user it performs the task that we want that application to. but if Terminate that application by TerminateProcess() , since its a abnormal closing , it does not perform what it should perform on a Gracefull exit. Now what I was thinking of is , If we could some how get HWND of this Process which we have created by CreateProcess() , then we could send WM_QUIT to this Hwnd , which would then do the task Grace fully, see what I am saying . Now problem is how to get this Damn HWND .. :( Help !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"
-
Our Purpose is to Launch an application , once launched and when closed by the user it performs the task that we want that application to. but if Terminate that application by TerminateProcess() , since its a abnormal closing , it does not perform what it should perform on a Gracefull exit. Now what I was thinking of is , If we could some how get HWND of this Process which we have created by CreateProcess() , then we could send WM_QUIT to this Hwnd , which would then do the task Grace fully, see what I am saying . Now problem is how to get this Damn HWND .. :( Help !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"
Use EnumThreadWindows. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
Our Purpose is to Launch an application , once launched and when closed by the user it performs the task that we want that application to. but if Terminate that application by TerminateProcess() , since its a abnormal closing , it does not perform what it should perform on a Gracefull exit. Now what I was thinking of is , If we could some how get HWND of this Process which we have created by CreateProcess() , then we could send WM_QUIT to this Hwnd , which would then do the task Grace fully, see what I am saying . Now problem is how to get this Damn HWND .. :( Help !! Abhishek Narula "Learn to appreciate others ... World would appreciate you"
Use EnumWindows to enumerate all top level windows. For each HWND do a GetWindowThreadProcessId to get the thread ID. Now compare with the dwThreadId you got from your PROCESS_INFORMATION struct that you passed to CreateProcess. If they match post a WM_CLOSE to that window Nish Bow wow wow, Yippee yo yippee yay, My miniputt high, Is now 30 yay.
-
Use EnumThreadWindows. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
:-O :-O :-O I feel embarassed :-( This is indeed the right solution. Ignore my post please [which is the most round about way to do this:(( ] Nish Bow wow wow, Yippee yo yippee yay, My miniputt high, Is now 30 yay.