MessageProc

3.1

  LRESULT CALLBACK MessageProc(code, wParam, lParam)    
  int code; /* message type */
  WPARAM wParam; /* undefined */
  LPARAM lParam; /* address of structure with message data */

The MessageProc function is an application- or library-defined callback function that the system calls after a dialog box, message box, or menu has retrieved a message, but before the message is processed. The callback function can process or modify the messages.

Parameters

code

Specifies the type of message being processed. This parameter can be one of the following values:

Value Meaning

MSGF_DIALOGBOX Messages inside a dialog box or message box procedure are being processed.
MSGF_MENU Keyboard and mouse messages in a menu are being processed.

If the code parameter is less than zero, the callback function must pass the message to CallNextHookEx without further processing and return the value returned by CallNextHookEx.

wParam

Specifies a NULL value.

lParam

Points to an MSG structure. 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 a nonzero value if it processes the message; it should return zero if it does not process the message.

Comments

The WH_MSGFILTER filter type is the only task-specific filter. A task may install this filter.

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

MessageProc 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 file.

See Also

CallNextHookEx, SetWindowsHookEx