Hi All!,
A friend of mine has a problem and i want to help him with it. He wants to know how to get all handles from different windows in an application, i mean, by a given PID i want to know every handle of every window in that process. Is this possible?.
BR,
NCR
A friend of mine has a problem and i want to help him with it. He wants to know how to get all handles from different windows in an application, i mean, by a given PID i want to know every handle of every window in that process. Is this possible?.
BR,
NCR
OK - you are going to enumerate all the windows.
Starting the the Desktop window, and using EnumWindows / EnumChildWindows api functions.
Each time you obtain a window handle, call GetWindowThreadProcessId to find out which thread (and process id) created this window, until you find a window whose owner process pid matches yours.
We have found the Application Window matching our PID :)
Cease enumerating the children of Desktop window.
Begin enumerating only the children of App window - which is what we really wanted :)
Hope this made sense.
Starting the the Desktop window, and using EnumWindows / EnumChildWindows api functions.
Each time you obtain a window handle, call GetWindowThreadProcessId to find out which thread (and process id) created this window, until you find a window whose owner process pid matches yours.
We have found the Application Window matching our PID :)
Cease enumerating the children of Desktop window.
Begin enumerating only the children of App window - which is what we really wanted :)
Hope this made sense.
thank you very much homer!.
Hi,
No real need to enumerate all of the processes on the desktop if you already have the process ID.
Edgar
No real need to enumerate all of the processes on the desktop if you already have the process ID.
invoke OpenProcess, PROCESS_ALL_ACCESS, FALSE,
mov , eax
; enumerate the handles here...
invoke CloseHandle,
Edgar