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);