LRESULT CALLBACK HardwareProc(code, wParam, lParam) | |||||
int code; | /* hook code | */ | |||
WPARAM wParam; | /* undefined | */ | |||
LPARAM lParam; | /* address of structure with event information | */ |
The HardwareProc function is an application-defined callback function that the system calls whenever the application calls the GetMessage or PeekMessage function and there is a hardware event to process. Mouse events and keyboard events are not processed by this hook.
code
Specifies whether the callback function should process the message or call the CallNextHookEx function. If this value is less than zero, the callback function should pass the message to CallNextHookEx without further processing. If this value is HC_NOREMOVE, the application is using the PeekMessage function with the PM_NOREMOVE option, and the message will not be removed from the system queue.
wParam
Specifies a NULL value.
lParam
Points to a HARDWAREHOOKSTRUCT structure. The HARDWAREHOOKSTRUCT structure has the following form:
typedef struct tagHARDWAREHOOKSTRUCT { /* hhs */
HWND hWnd;
UINT wMessage;
WPARAM wParam;
LPARAM lParam;
} HARDWAREHOOKSTRUCT;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
The callback function should return zero to allow the system to process the message; it should be 1 if the message is to be discarded.
This callback function should not install a playback hook because the function cannot use the GetMessageExtraInfo function to get the extra information associated with the message.
The callback function must use the Pascal calling convention and must be declared FAR. An application must install the callback function by specifying the WH_HARDWARE filter type and the procedure-instance address of the callback function in a call to the SetWindowsHookEx function.
HardwareProc is a placeholder for the library-defined function name. The actual name must be exported by including it in an EXPORTS statement in the library's module-definition (.DEF) file.