WinSendDlgItemMsg
Appearance
This function sends a message to the dialog item defined by idItem in the dialog window specified by hwndDlg.
Syntax
WinSendDlgItemMsg(hwndDlg, idItem, msg, mp1, mp2)
Parameters
- hwndDlg (HWND) - Input
- Parent-window handle (dialog window).
- idItem (ULONG) - Input
- Identity of the child window (dialog item), between 0 and 0xFFFF.
- msg (ULONG) - Input
- Message identifier.
- mp1 (MPARAM) - Input
- Message parameter 1.
- mp2 (MPARAM) - Input
- Message parameter 2.
- mresReply (MRESULT) - Returns
- Message-return data from the dialog item's window procedure.
Returns
- mresReply (MRESULT) - returns
- Message-return data from the window procedure of the dialog item.
Remarks
This function is equivalent to WinSendMsg, where the receiving window procedure is identified by the child window's item ID and the parent window's handle.
It does not return until the message has been processed by the dialog item, and its return value is provided in mresReply.
The call is equivalent to:
WinSendMsg (WinWindowFromID(hwndDlg, idItem), msgid, param1, param2, reply);
While valid for any window with children, this function is typically used for dialog items within a dialog window.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.
Example Code
#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDlg; /* Parent-window handle. */ ULONG idItem; /* Identity of the child window. */ ULONG msg; /* Message identity. */ MPARAM mp1; /* Message parameter 1. */ MPARAM mp2; /* Message parameter 2. */ MRESULT mresReply; /* Message-return data. */ mresReply = WinSendDlgItemMsg(hwndDlg, idItem, msg, mp1, mp2);
This example processes an application-defined message (IDM_SHOW) and sets a check mark next to the selected item.
#define INCL_WIN #define INCL_WINDIALOGS #include <OS2.H> #define IDM_SHOW 902 HWND hwndFrame; ULONG msg; MPARAM mp1; /* Inside client procedure. */ switch(msg) { case WM_COMMAND: /* The user has chosen a menu item. Process the selection */ /* accordingly. */ switch ( SHORT1FROMMP( mp1 ) ) { case IDM_SHOW: WinSendDlgItemMsg(hwndFrame, (ULONG) FID_MENU, (ULONG) MM_SETITEMATTR, MPFROM2SHORT(IDM_SHOW, TRUE), MPFROM2SHORT(MIA_CHECKED,MIA_CHECKED)); break; } break; }
Related Functions
- WinBroadcastMsg
- WinCreateMsgQueue
- WinDestroyMsgQueue
- WinDispatchMsg
- WinGetDlgMsg
- WinGetMsg
- WinInSendMsg
- WinPeekMsg
- WinPostMsg
- WinPostQueueMsg
- WinQueryMsgPos
- WinQueryMsgTime
- WinQueryQueueInfo
- WinQueryQueueStatus
- WinSendMsg
- WinSetClassMsgInterest
- WinSetMsgInterest
- WinSetMsgMode
- WinSetSynchroMode
- WinWaitMsg