Вопрос

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?

enter image description here

I used:

  1. FindProcessId

    and then

    hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, id);
    

    or

    hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
    
  2. Create process not work: access denied.

  3. FindWindow() does not work for this hidden window.

How can I get the handle for the hidden window so I can terminate the process?

Это было полезно?

Решение

FindWindow will search any type of Windows and it does not matter it's hidden or not.

Maybe your problem with FindWindow is that, window you were looking for, was child of another one and for this reason you are unable to find that.

So you should use FindWindowEx and search into children's windows.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top