I need get the HANDLE
or HWND
of a hidden window to terminate it with EndTask((HWND)hProc,TRUE,TRUE);
. I used all ways listed below but none of them work. When I manually set a handle to a hidden window with spy++, this worked correctly.
NOTE: This window not show with ShowWindow()
and then use FindWindow()
. How does spy++ get and show these handles?
I used:
FindProcessId
and then
hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, id);
or
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
Create process not work: access denied.
FindWindow()
does not work for this hidden window.
How can I get the handle for the hidden window so I can terminate the process?