LRESULT CALLBACK JournalPlaybackProc(nCode, wParam, lParam) | |||||
int nCode; | /* hook code | */ | |||
WPARAM wParam; | /* undefined | */ | |||
LPARAM lParam; | /* pointer to message being processed | */ |
The JournalPlaybackProc function is an application- or library defined callback function that inserts mouse and keyboard messages into the system message queue. Typically, an application or library uses this function to play back a series of mouse and keyboard messages that were recorded earlier by using the JournalRecordProc function. Regular mouse and keyboard input is disabled as long as a JournalPlaybackProc function is installed.
nCode
Specifies a hook code that the callback function can use to determine how to process the message. This parameter can be one of the following values:
Value | Meaning |
HC_GETNEXT | ||
Indicates the filter function should copy the current mouse or keyboard message to the MSG structure pointed to the lParam parameter. | ||
HC_SKIP | ||
Indicates the filter function should prepare to copy the next mouse or keyboard message to the MSG structure pointed to the lParam parameter. The filter function should copy the message when it next receives the HC_GETNEXT code. | ||
HC_SYSMODALOFF | ||
Indicates a system-modal dialog box has been destroyed. | ||
HC_SYSMODALON | ||
Indicates a system-modal dialog box is being displayed. The filter function should unhook itself until the dialog box has been destroyed. |
If the nCode parameter is less then zero, the callback function should pass the message to CallNextHookEx without further processing.
wParam
Specifies a NULL value.
lParam
Points to an MSG structure that represents message being processed by the callback function. This parameter is valid only when the nCode parameter is set to HC_GETNEXT. The MSG structure has the following form:
typedef struct tagMSG { /* msg */
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
The callback function should return a value that represents the amount of time (in clock ticks) that the system should wait before processing the message. This value can be computed by calculating the difference between the time fields in the current and previous input messages. If the function returns zero, the message is processed immediately. The return value is only used if the nCode parameter is set to HC_GETNEXT. Otherwise, it is ignored.
The JournalPlaybackProc function should copy an input message to the lParam parameter. The message must have been previously recorded by using a JournalRecordProc callback function. It should not modify the message.
Once the function returns control to the system, the message continues to be processed. If the nCode parameter is HC_SKIP, the filter function should prepare to return the next recorded event message on its next call.
An application must install the callback function by specifying the WH_JOURNALPLAYBACK filter type and address of the callback function in a call to the SetWindowsHook function.
JournalPlaybackProc is a placeholder for the application- or library-defined function name. The actual name must be exported by including it in the EXPORTS statement in a module-definition file.
CallNextHookEx, JournalRecordProc, SetWindowsHookEx