WinDispatchMsg: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
;hab ([[HAB] | ;hab ([[HAB]]) - Input: Anchor-block handle. | ||
;pqmsgMsg ( | ;pqmsgMsg (P[[QMSG]]) - Input: Message structure. | ||
;mresReply ( | ;mresReply ([[MRESULT]]) - Returns: Message-return data. | ||
==Returns== | ==Returns== | ||
Line 13: | Line 13: | ||
==Remarks== | ==Remarks== | ||
This function is equivalent to using the [[WinSendMsg]] function with the parameters corresponding to those in | This function is equivalent to using the [[WinSendMsg]] function with the parameters corresponding to those in ''pqmsgMsg''. | ||
The time and pointer position information within `pqmsgMsg` can be obtained by the window procedure with the [[WinQueryMsgTime]] and [[WinQueryMsgPos]] functions. | The time and pointer position information within `pqmsgMsg` can be obtained by the window procedure with the [[WinQueryMsgTime]] and [[WinQueryMsgPos]] functions. | ||
''mresReply'' is the value returned by the invoked window procedure. For standard window classes, the values of `mresReply` are documented with the message definitions. | |||
==Example Code== | ==Example Code== |
Latest revision as of 03:32, 9 April 2025
This function invokes a window procedure.
Syntax
WinDispatchMsg(hab, pqmsgMsg)
Parameters
- hab (HAB) - Input
- Anchor-block handle.
- pqmsgMsg (PQMSG) - Input
- Message structure.
- mresReply (MRESULT) - Returns
- Message-return data.
Returns
The WinDispatchMsg function returns an MRESULT value that represents the data returned by the invoked window procedure.
Remarks
This function is equivalent to using the WinSendMsg function with the parameters corresponding to those in pqmsgMsg.
The time and pointer position information within `pqmsgMsg` can be obtained by the window procedure with the WinQueryMsgTime and WinQueryMsgPos functions.
mresReply is the value returned by the invoked window procedure. For standard window classes, the values of `mresReply` are documented with the message definitions.
Example Code
#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PQMSG pqmsgMsg; /* Message structure. */ MRESULT mresReply; /* Message-return data. */ mresReply = WinDispatchMsg(hab, pqmsgMsg);
This example uses `WinDispatchMsg` within a WinGetMsg loop to dispatch window messages to a window procedure.
#define INCL_WINMESSAGEMGR /* Window Message Functions */ #define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> HAB hab; /* anchor-block handle */ HMQ hmq; /* message queue handle */ QMSG qmsg; /* message */ hab = WinInitialize(0); /* initialize PM */ hmq = WinCreateMsgQueue(hab, 0); /* create default size queue */ /* ... initialize windows ... */ /* get and dispatch messages from queue */ while (WinGetMsg(hab, &qmsg, 0, 0, 0)) WinDispatchMsg(hab, &qmsg);
Related Functions
- WinBroadcastMsg
- WinCancelShutdown
- WinCreateMsgQueue
- WinDestroyMsgQueue
- WinGetDlgMsg
- WinGetMsg
- WinInSendMsg
- WinPeekMsg
- WinPostMsg
- WinPostQueueMsg
- WinQueryMsgPos
- WinQueryMsgTime
- WinQueryQueueInfo
- WinQueryQueueStatus
- WinSendDlgItemMsg
- WinSendMsg
- WinSetClassMsgInterest
- WinSetMsgInterest
- WinSetMsgMode
- WinSetSynchroMode
- WinWaitMsg