Capture and write all to the Windows message queue

Does anyone have a working code example on how to connect to the Windows message queue (post / sendMessage) and register all messages there? Preferably in Python. I am interested in this to simplify the creation of test scripts that emulate user input.

+3
source share
3 answers

This is usually done using the SetWindowsHookEx function .

In Python, you should probably use third-party libraries such as Python extensions for Windows . PyCWnd.HookMessage and PyCWnd.HookAllKeyStrokes may be what you need.

+1
source

In fact, the package that wraps the SetWindowsHookEx function is called pyHook . I used it before to write a primitive registrar key (as an experiment to monitor myself, to help report hours of operation), and it did a great job of this.

+2
source

SetWinEventHook, . , , DLL. , , SetWinEventHook, , Windows . , DLL, , .

+1

Source: https://habr.com/ru/post/1715621/


All Articles