GetMsgProc

3.1

  LRESULT CALLBACK GetMsgProc(code, wParam, lParam)    
  int code; /* process-message flag, */  
  WPARAM wParam; /* undefined */
  LPARAM lParam; /* pointer to MSG structure */

The GetMsgProc function is a library-defined callback function that the system calls whenever the GetMessage function has retrieved a message from an application queue. The system passes the retrieved message to the callback function before passing the message to the destination window procedure.

Parameters

code

Specifies whether the callback function should process the message or call the CallNextHookEx function. If this parameter is less than 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 contains information about the message. The MSG structure has the following form:

typedef struct tagMSG {     /* msg */
    HWND   hwnd;
    UINT   message;
    WPARAM wParam;
    LPARAM lParam;
    DWORD  time;
    POINT  pt;
} MSG;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

Return Value

The callback function should return zero.

Comments

The GetMsgProc callback function can examine or modify the message as desired. Once the callback function returns control to the system, the GetMessage function returns the message, with any modifications, to the application that originally called it. The callback function does not require a return value.

This callback function must be in a dynamic-link library (DLL).

An application must install the callback function by specifying the WH_GETMESSAGE filter type and the procedure-instance address of the callback function in a call to the SetWindowsHookEx function.

GetMsgProc 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.

See Also

CallNextHookEx, GetMessage, SetWindowsHookEx