Question: 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?

Answer: 
Here is a pretty complete example of how to implement the spy++ finder.

<http://www.codeproject.com/KB/dialog/windowfinder.aspx>
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.