I am curious how spy++ Finder Tool finds out the window handle for the window over which the mouse is. Is there any WIN32 function for getting the handle of the topmost window that occupies a certain pixel on the display?
views:
356answers:
4since that returns a `HWND`, would `WindowFromPoint` work with windows from another process?
Evan Teran
2009-08-25 18:26:59
HWNDs are valid throughout the whole OS, so yes.
DeusAduro
2009-08-25 18:28:23
thanks, that's what i was looking for.I used something like this before: HWND wnd = (HWND)0x....; SendMessage(wnd,...); and it worked fine(it was a window for another application), so i think it works with that handle too. :)
Razvi
2009-08-25 18:29:40
A:
Don't quote me on it, but I believe spy++ would install a WH_CALLWNDPROC hook. This then gets sent all the WM_MOUSEMOVE messages before they reach their target windows. Thus as soon as you mouse over a window, spy++ recieves a message telling it which window.
DeusAduro
2009-08-25 18:25:34
+4
A:
Here is a pretty complete example of how to implement the spy++ finder.
sylvanaar
2009-08-25 18:38:47