MessageProc

  LRESULT CALLBACK MessageProc(nCode, wParam, lParam)    
  int nCode; /* message type */
  WPARAM wParam; /* undefined */
  LPARAM lParam; /* pointer to 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

nCode

Specifies the type of message being processed. It must be one of the following values:

Value Meaning

MSGF_DIALOGBOX  
  Processing messages inside a dialog box or message box procedure.
MSGF_MENU  
  Processing keyboard and mouse messages in a menu.

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

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;

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 SetWindowsHook function.

MessageProc is a placeholder for the library-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the library's module-definition file.

See Also

DefHookProc, SetWindowsHook