[python-win32] Click detection in Windows (was 'HookMessage Failure?')
b6y9eq902@sneakemail.com
b6y9eq902 at sneakemail.com
Sat May 7 21:52:11 CEST 2005
Sorry for lack of reply to this, I've had some other stuff come up.
To rehash: I'm basically trying to detect clicks to a particular windows application. I've tried registering a callback via PyCWnd.HookMessage (as in the reply quoted below), but it didn't seem to work at all.
Is there any way to simply detect *all* mouse clicks in Windows? I'd prefer to detect when it's clicked in the application, but if necessary I'm fine just trying to detect all of them and seeing if my desired application is the foreground window.
Is this possible? How would I go about doing this?
Thanks, -Mark
On Apr 10, 2005 1:12 AM, Marcus Goldfish <magoldfish at .........> wrote:
Did you get this to work? I tried the following snippet to no avail.
Anyone have suggestions?
import winGuiAuto
import win32ui, win32con
def handler(*args):
print "handler called"
hwnd = winGuiAuto.findTopWindow("calculator")
pwin = win32ui.CreateWindowFromHandle(hwnd)
pwin.HookMessage(handler, win32con.WM_LBUTTONDOWN)
More information about the Python-win32
mailing list