[python-win32] Click detection in Windows (was 'HookMessageFailure?')
Mark Hammond
mhammond at skippinet.com.au
Sun May 8 12:59:32 CEST 2005
> 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.
HookMessage has nothing to do with a "Windows Message Hook" - it only works
when the message has its WNDPROC implemented in MFC.
> 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?
You probably want something like SetWindowsHookEx - see MSDN. This is not
wrapped by pywin32 - you may find ctypes useful for using it.
Mark
More information about the Python-win32
mailing list