How can I get handle to the main process window having the process id? I knew that there is a FindWindow
function but I don't wanna search by the window name. I just have a process id of the window's owner.
Asked
Active
Viewed 26 times
0

darek_911
- 81
- 1
- 7
-
https://stackoverflow.com/questions/1888863/how-to-get-main-window-handle-from-process-id – Pepijn Kramer Sep 25 '21 at 10:09
-
Use EnumWindows + GetWindowThreadProcessId. Beware the ambiguity, there is no mechanism in the winapi to designate a window to be the "main process window". – Hans Passant Sep 25 '21 at 10:13