Export (0) Print
Expand All

GetMsgProc callback function

An application-defined or library-defined callback function used with the SetWindowsHookEx function. The system calls this function whenever the GetMessage or PeekMessage function has retrieved a message from an application message queue. Before returning the retrieved message to the caller, the system passes the message to the hook procedure.

The HOOKPROC type defines a pointer to this callback function. GetMsgProc is a placeholder for the application-defined or library-defined function name.

Syntax


LRESULT CALLBACK GetMsgProc(
  _In_  int code,
  _In_  WPARAM wParam,
  _In_  LPARAM lParam
);

Parameters

code [in]

Type: int

Specifies whether the hook procedure must process the message. If code is HC_ACTION, the hook procedure must process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx.

wParam [in]

Type: WPARAM

Specifies whether the message has been removed from the queue. This parameter can be one of the following values.

ValueMeaning
PM_NOREMOVE
0x0000

The message has not been removed from the queue. (An application called the PeekMessage function, specifying the PM_NOREMOVE flag.)

PM_REMOVE
0x0001

The message has been removed from the queue. (An application called GetMessage, or it called the PeekMessage function, specifying the PM_REMOVE flag.)

 

lParam [in]

Type: LPARAM

A pointer to an MSG structure that contains details about the message.

Return value

Type:

Type: LRESULT

If code is less than zero, the hook procedure must return the value returned by CallNextHookEx.

If code is greater than or equal to zero, it is highly recommended that you call CallNextHookEx and return the value it returns; otherwise, other applications that have installed WH_GETMESSAGE hooks will not receive hook notifications and may behave incorrectly as a result. If the hook procedure does not call CallNextHookEx, the return value should be zero.

Remarks

The GetMsgProc hook procedure can examine or modify the message. After the hook procedure returns control to the system, the GetMessage or PeekMessage function returns the message, along with any modifications, to the application that originally called it.

An application installs this hook procedure by specifying the WH_GETMESSAGE hook type and a pointer to the hook procedure in a call to the SetWindowsHookEx function.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

See also

Reference
CallNextHookEx
GetMessage
MSG
PeekMessage
SetWindowsHookEx
Conceptual
Hooks

 

 

Community Additions

ADD
Show:
© 2014 Microsoft