def shell__register_window_hook(hwnd, message_id_callbacks=None, callback=None):
"""
Registers the "shell hook" window message with the window, and inserts the
callback into the message_id_callbacks dict for processing, because
the message ID is dynamically created.
:param hwnd:
:param message_id_callbacks:
:param callback:
:return: the message ID for the shell hook message.
"""
assert message_id_callbacks is None or isinstance(message_id_callbacks, dict)
if not RegisterShellHookWindow(hwnd):
raise WinError()
message_id = RegisterWindowMessageW("SHELLHOOK")
if message_id_callbacks:
message_id_callbacks[message_id] = callback
return message_id
评论列表
文章目录