Perhaps not quite clearly expressed. The task is to determine the location (coordinates) of a click on the window (a separate application). The coordinates are determined using win32api.GetCursorPos ().
2 answers
Try using the winapi WindowFromPoint function http://msdn.microsoft.com/en-us/library/ms633558(v=vs.85).aspx
This function is not in the win32api module, so you’ll probably have to write your own module in C or Cython in which to make a wrapper for this function.
Himself came across a wonderful project pyHook
http://sourceforge.net/apps/mediawiki/pyhook/index.php?title=Main_Page
True, there are small problems with compilation, but everything is solved!
Work example:
MessageName: mouse right down
Message: 516
Time: 8590562
Window: 1312060
WindowName: C: Python26python.exe
Position: (408, 227)
Wheel: 0
Injected: 0
MessageName: key down
Message: 256
Time: 8591406
Window: 1312060
WindowName: C: Python26python.exe
Ascii: 27 <
Key: Escape
KeyID: 27
ScanCode: 1
Extended: 0
Injected: 0
Alt 0
Transition 0