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
Posted on 2010-03-31 17:45:33 by 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.
Posted on 2010-03-31 20:54:21 by Homer
thank you very much homer!.
Posted on 2010-04-05 08:44:51 by NCR
Hi,

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
Posted on 2010-04-06 16:05:28 by donkey