MsgInputHook
Appearance
This function is specific to OS/2 Version 2.1 or higher.
Syntax
MsgInputHook(hab, pQmsg, fSkip, pfNoRecord);
Parameters
- hab (HAB) - input
- Anchor-block handle.
- pQmsg (PQMSG) - in/out
- Queue message data structure.
- A queue message data structure to be filled in with a simulated mouse or keyboard message.
- fSkip (BOOL) - input
- Skip message flag.
- TRUE: The hook should advance to the next message. No message is passed in when fSkip is set to TRUE. The pQmsg parameter is NULL in this case. When the hook is called with fSkip set to TRUE and there are no further messages to pass in, the MsgInputHook hook must be released using WinReleaseHook.
- FALSE: The current message should be returned. As long as the hook procedure is called with fSkip set to FALSE, the hook must continue to return the same message.
- pfNoRecord (PBOOL) - output
- Record message flag.
- TRUE: The message will not be recorded in the JournalRecordHook hook. Unless journal recording is specifically needed by the application, this parameter should always be TRUE.
- FALSE: The message will be recorded in the JournalRecordHook hook.
Returns
- rc (BOOL) - returns
- Return code.
- TRUE: The QMSG structure contains the current message to be passed in for handling.
- FALSE: The QMSG structure was not filled in. There are no further messages to pass in.
Remarks
This hook is intended for simulated user input, and only mouse and keyboard messages should be passed in. All other messages will be discarded. Mouse and keyboard messages injected into this hook will have the same effect as if they were generated by the mouse or keyboard device driver. The messages are routed in the same manner as normal user input.
The pfNoRecord parameter defaults to TRUE, implying that messages received from the MsgInputHook hook will not be recorded in the JournalRecordHook hook. Injected messages should not be recorded unless necessary.
When all messages have been passed in the application must remove the MsgInputHook hook using WinReleaseHook.
Example Code
#define INCL_WINHOOKS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PQMSG pQmsg; /* Queue message data structure. */ BOOL fSkip; /* Skip message flag. */ PBOOL pfNoRecord;/* Record message flag. */ BOOL rc; /* Return code. */ rc = MsgInputHook(hab, pQmsg, fSkip, pfNoRecord);