PyCCmdTarget.HookNotify

object = HookNotify(obHandler, id )

Hook a windows command handler.

Parameters

obHandler : object

The handler for the command message. This must be a callable object.

id : int

The ID of the command to be handled, or zero to handle all command messages.

Comments

obHandler will be called as the application receives control notification messages. These may also be handled via PyCCmdTarget::HookCommand, but this method is specific to control notifications, and therefore provides more information.

The handler will be called with 2 arguments
A tuple describing standard notification information.
A tuple describing extra notification params, or an integer containing the address of the first byte of the extended information.
If the handler returns TRUE, then the command will be passed on to the default handler, otherwise the message will be consumed.

Certain notification codes are recognised internally, and these are converted to a Python tuple. If the extra information is not recognised, the address is passed. These addresses could be extracted using win32ui::GetBytes and the struct module, or using Sam Rushing's calldll/dynwin module. (It would be possible to extend Pythonwin so a program can install certain knowledge about handlers, but this has not been implemented.)

Return Value

The return value is the previous handler, or None.