CallMsgFilterW function (winuser.h)

Passes the specified message and hook code to the hook procedures associated with the WH_SYSMSGFILTER and WH_MSGFILTER hooks. A WH_SYSMSGFILTER or WH_MSGFILTER hook procedure is an application-defined callback function that examines and, optionally, modifies messages for a dialog box, message box, menu, or scroll bar.

Syntax

BOOL CallMsgFilterW(
  [in] LPMSG lpMsg,
  [in] int   nCode
);

Parameters

[in] lpMsg

Type: LPMSG

A pointer to an MSG structure that contains the message to be passed to the hook procedures.

[in] nCode

Type: int

An application-defined code used by the hook procedure to determine how to process the message. The code must not have the same value as system-defined hook codes (MSGF_ and HC_) associated with the WH_SYSMSGFILTER and WH_MSGFILTER hooks.

Return value

Type: BOOL

If the application should process the message further, the return value is zero.

If the application should not process the message further, the return value is nonzero.

Remarks

The system calls CallMsgFilter to enable applications to examine and control the flow of messages during internal processing of dialog boxes, message boxes, menus, and scroll bars, or when the user activates a different window by pressing the ALT+TAB key combination.

Install this hook procedure by using the SetWindowsHookEx function.

Examples

For an example, see WH_MSGFILTER and WH_SYSMSGFILTER Hooks.

Note

The winuser.h header defines CallMsgFilter as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-message-l1-1-0 (introduced in Windows 8)

See also

Conceptual

Hooks

MSG

MessageProc

Reference

SetWindowsHookEx

SysMsgProc