Jump to content

MsgControlHook

From EDM2
Revision as of 19:38, 9 April 2025 by Martini (talk | contribs) (Created page with "This hook allows the call to determine the flow of messages to be intercepted. ==Syntax== MsgControlHook(hab, idContext, hwnd, pszClassName, usMsgClass, idControl, fSuccess); ==Parameters== ;hab (HAB) - input : Anchor-block handle. ;idContext (LONG) - input : Origin of call to hook. :;MCHK_CLASSMSGINTEREST: WinSetClassMsgInterest :;MCHK_MSGINTEREST: WinSetMsgInterest :;MCHK_MSGMODE: WinSetMsgMode :;MCHK_SYNCHRONISATION: WinSetSynchroMode ;hwnd (HWND)...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This hook allows the call to determine the flow of messages to be intercepted.

Syntax

MsgControlHook(hab, idContext, hwnd, pszClassName, usMsgClass, idControl, fSuccess);

Parameters

hab (HAB) - input
Anchor-block handle.
idContext (LONG) - input
Origin of call to hook.
MCHK_CLASSMSGINTEREST
WinSetClassMsgInterest
MCHK_MSGINTEREST
WinSetMsgInterest
MCHK_MSGMODE
WinSetMsgMode
MCHK_SYNCHRONISATION
WinSetSynchroMode
hwnd (HWND) - input
Window handle.
This is the same as the window handle in the hwnd parameter of the WinSetMsgInterest function.
pszClassName (PSZ) - input
Window class name.
This is the same as the window class name in the pszClassName parameter of the WinSetClassMsgInterest function.
usMsgClass (ULONG) - input
Message class.
This is the same as the message class in the ulMsgClass parameter of the WinSetMsgInterest and the WinSetClassMsgInterest functions.
idControl (LONG) - input
Control setting.
The setting varies with the value of the idContext parameter.
For MCHK_CLASSMSGINTEREST
it can be SMI_INTEREST, or SMI_NOINTEREST, or SMI_AUTODISPATCH.
For MCHK_MSGINTEREST
it can be SMI_INTEREST, or SMI_NOINTEREST, or SMI_RESET, or SMI_AUTODISPATCH.
For MCHK_MSGMODE
it can be SMD_DELAYED or SMD_IMMEDIATE.
For MCHK_SYNCHRONISATION
it can be SSM_SYNCHRONOUS, or SSM_ASYNCHRONOUS, or SSM_MIXED.
fSuccess (PBOOL) - in/out
Success indicator.
TRUE
Mode or interest successfully set.
FALSE
Mode or interest not successfully set.

Returns

rc (BOOL) - returns
Processing indicator.
TRUE
Do not call next hook in chain
FALSE
Call next hook in chain.

Remarks

If the hook is unable to alter the message control state, then the hook must establish the relevant error information.

Example Code

#define INCL_WINHOOKS /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB      hab;           /*  Anchor-block handle. */
LONG     idContext;     /*  Origin of call to hook. */
HWND     hwnd;          /*  Window handle. */
PSZ      pszClassName;  /*  Window class name. */
ULONG    usMsgClass;    /*  Message class. */
LONG     idControl;     /*  Control setting. */
PBOOL    fSuccess;      /*  Success indicator. */
BOOL     rc;            /*  Processing indicator. */

rc = MsgControlHook(hab, idContext, hwnd,
       pszClassName, usMsgClass, idControl,
       fSuccess);