Jump to content

WinBroadcastMsg

From EDM2
Revision as of 01:27, 13 May 2023 by Martini (talk | contribs) (Created page with "This function broadcasts a message to multiple windows. ==Syntax== WinBroadcastMsg(hwndParent, ulMsgId, mpParam1, mpParam2, flCmd); ==Parameters== ;hwndParent (HWND) - inp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function broadcasts a message to multiple windows.

Syntax

WinBroadcastMsg(hwndParent, ulMsgId, mpParam1, mpParam2, flCmd);

Parameters

hwndParent (HWND) - input
Parent-window handle.
ulMsgId (ULONG) - input
Message identifier.
mpParam1 (MPARAM) - input
Parameter 1.
mpParam2 (MPARAM) - input
Parameter 2.
flCmd (ULONG) - input
Broadcast message command.
BMSG_POST
Post the message. This value is mutually exclusive with BMSG_SEND and BMSG_POSTQUEUE.
BMSG_SEND
Send the message. This value is mutually exclusive with BMSG_POST and BMSG_POSTQUEUE.
BMSG_POSTQUEUE
Post a message to all threads that have a message queue. This value is mutually exclusive with BMSG_POST and BMSG_SEND. The hwnd parameter of the QMSG structure is set to NULL.
BMSG_DESCENDANTS
Broadcast the message to all the descendants of the hwndParent parameter.
BMSG_FRAMEONLY
Broadcast the message only to windows with a style of CS_FRAME.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Message was sent or posted successfully to all applicable windows
FALSE
Error occurred.

Remarks

This function sends or posts a message to all the immediate child windows of hwndParent, except in the case when flCmd is BMSG_DESCENDANTS.

The ulMsgId, mpParam1, and mpParam2 parameters make up the message sent or posted. The window handle of the receiving window is added to the message.

Example Code

This example broadcasts a WM_CLOSE message to all descendants of the specified window.

#define INCL_WINMESSAGEMGR      /* Window Message Functions     */
#include <os2.h>

BOOL  fSuccess;         /* Success indicator                    */
HWND  hwndParent;       /* parent window handle                 */
ULONG   ulMsgId;        /* Message identifier                   */
MPARAM  mpParam1;       /* Parameter 1                          */
MPARAM  mpParam2;       /* Parameter 2                          */
ULONG   flCmd;          /* message command                      */

/* set msg to close window, parameters to NULL */
ulMsgId = WM_CLOSE;
mpParam1 = MPVOID;
mpParam2 = MPVOID;

/* broadcast to all descendants */
flCmd = BMSG_DESCENDANTS;

fSuccess = WinBroadcastMsg(hwndParent, ulMsgId, mpParam1,
                            mpParam2, flCmd);

Definition

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

HWND      hwndParent;  /*  Parent-window handle. */
ULONG     ulMsgId;     /*  Message identifier. */
MPARAM    mpParam1;    /*  Parameter 1. */
MPARAM    mpParam2;    /*  Parameter 2. */
ULONG     flCmd;       /*  Broadcast message command. */
BOOL      rc;          /*  Success indicator. */

rc = WinBroadcastMsg(hwndParent, ulMsgId,
       mpParam1, mpParam2, flCmd);

Related Functions

  • WinBroadcastMsg
  • WinCreateMsgQueue
  • WinDestroyMsgQueue
  • WinDispatchMsg
  • WinGetDlgMsg
  • WinGetMsg
  • WinInSendMsg
  • WinPeekMsg
  • WinPostMsg
  • WinPostQueueMsg
  • WinQueryMsgPos
  • WinQueryMsgTime
  • WinQueryQueueInfo
  • WinQueryQueueStatus
  • WinSendDlgItemMsg
  • WinSendMsg
  • WinSetClassMsgInterest
  • WinSetMsgInterest
  • WinSetMsgMode
  • WinSetSynchroMode
  • WinWaitMsg