Getting handle of hidden window from another process
-
I have an EXE that has a hidden window. Is it possible to obtain a handle to this window and post a WM_QUIT message. The basic requirement that I have is that I need to un-install an application and before the process of un-install , I need to kill the process .
-
I have an EXE that has a hidden window. Is it possible to obtain a handle to this window and post a WM_QUIT message. The basic requirement that I have is that I need to un-install an application and before the process of un-install , I need to kill the process .
Something like this would work.
VOID YourClass::EnumerateWindows() { EnumWindows(EnumWindowsProc,0); } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { DWORD dwPID = 0; GetWindowThreadProcessId(hWnd,&dwPID); if(dwTargetPID == dwPID) { if (!(GetWindowLong(hWnd,GWL_STYLE) & WS_VISIBLE)) { ::PostMessage(hWnd,WM_CLOSE,0,0); } } return(TRUE); }
-
I have an EXE that has a hidden window. Is it possible to obtain a handle to this window and post a WM_QUIT message. The basic requirement that I have is that I need to un-install an application and before the process of un-install , I need to kill the process .
act_x wrote:
before the process of un-install , I need to kill the process .
cruel programming. :-D