Jump to content

WinSetMsgMode

From EDM2
Revision as of 00:43, 9 April 2025 by Martini (talk | contribs) (Created page with "This function ''indicates the mode for the generation and processing of messages for the private window class of an application''. ==Syntax== WinSetMsgMode(hab, pszClassName, lControl) ==Parameters== ;hab (HAB) - Input: Anchor block handle. ;pszClassName (PSZ) - Input: Window class name. ;lControl (LONG) - Input: Message mode identifier. :;SMD_DELAYED ::The generation of messages may be delayed. :;SMD_IMMEDIATE ::The generation of messages will not be dela...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function indicates the mode for the generation and processing of messages for the private window class of an application.

Syntax

WinSetMsgMode(hab, pszClassName, lControl)

Parameters

hab (HAB) - Input
Anchor block handle.
pszClassName (PSZ) - Input
Window class name.
lControl (LONG) - Input
Message mode identifier.
SMD_DELAYED
The generation of messages may be delayed.
SMD_IMMEDIATE
The generation of messages will not be delayed.
rc (BOOL) - Returns
TRUE if message mode was successfully set, FALSE otherwise.

Returns

rc (BOOL) - returns
Message delay indicator.
TRUE
Message mode successfully set
FALSE
Message mode not successfully set.

Remarks

This function has no effect unless the MsgControlHook hook, which is invoked by this function, has been set.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.

Example Code

#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#include <os2.h>

HAB   hab;          /* Anchor block handle. */
PSZ   pszClassName; /* Window class name. */
LONG  lControl;     /* Message mode identifier. */
BOOL  rc;           /* Message delay indicator. */

rc = WinSetMsgMode(hab, pszClassName, lControl);

This example sets a delayed message processing mode for the private window class "Generic".

#define INCL_WINWINDOWMGR
#define INCL_WINMESSAGEMGR
#include <OS2.H>
HWND hwnd;
HAB hab;
PFNWP GenericWndProc;
CHAR szClassName[] = "Generic"; /* window class name      */

 if (!WinRegisterClass(hab,   /* anchor-block handle      */
          szClassName,        /* class name               */
          GenericWndProc,     /* window procedure         */
          0L,                 /* window style             */
          0));                /* amount of reserved memory */
     return (FALSE);

 WinSetMsgMode(hab,
          "Generic",
          SMD_DELAYED);

Related Functions