WinQueryMsgTime: Difference between revisions
Appearance
Created page with "Returns the time in milliseconds when the last message retrieved from the queue was posted. ==Syntax== WinQueryMsgTime(hab) ==Parameter== ;hab (HAB):handle to anchor-bl..." |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
This function returns the message time for the last message retrieved by the [[WinGetMsg]] or [[WinPeekMsg]] functions from the current message queue. | |||
==Syntax== | == Syntax == | ||
<pre> | |||
WinQueryMsgTime(hab); | |||
</pre> | |||
== | == Parameters == | ||
;hab ([[HAB]]): | ;''hab'' ([[HAB]]) - input: Anchor-block handle. | ||
; | == Returns == | ||
;''ulTime'' ([[ULONG]]) - returns: Time in milliseconds. | |||
== Remarks == | |||
The message time is the time the message is posted, measured in milliseconds, from the time the system is started. Its value is the same as that in the parameter of the [[QMSG]] structure. | |||
To calculate time delays between messages, the time of the first message is subtracted from the time of the second message. | |||
Time values do not always increase because the value is the number of milliseconds since the system was started, and the system accumulator for this count can wrap through zero. | |||
== Example Code == | |||
Declaration: | |||
<pre> | |||
#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, */ | |||
#include <os2.h> | |||
HAB hab; /* Anchor-block handle. */ | |||
ULONG ulTime; /* Time in milliseconds. */ | |||
ulTime = WinQueryMsgTime(hab); | |||
</pre> | |||
This example returns position and time of the the last message obtained from the current message queue. | |||
<pre> | |||
#define INCL_WINMESSAGEMGR | |||
#define INCL_WINDIALOGS | |||
#include <OS2.H> | |||
#include <stdio.h> | |||
HAB hab; | |||
POINTL ptl; | |||
CHAR szMsg[100]; | |||
HWND hwnd; | |||
ULONG ulTime; | |||
WinQueryMsgPos(hab, &ptl); | |||
ulTime = WinQueryMsgTime(hab); | |||
sprintf(szMsg, "x = %ld y = %ld\n\ntime = %ld", | |||
ptl.x, ptl.y, ulTime); | |||
WinMessageBox(HWND_DESKTOP, | |||
hwnd, /* client-window handle */ | |||
szMsg, /* body of the message */ | |||
"Debugging information", /* title of the message */ | |||
0, /* message box id */ | |||
MB_NOICON | MB_OK); /* icon and button flags */ | |||
</pre> | |||
== Related Functions == | |||
* [[WinGetCurrentTime]] | |||
* [[WinStartTimer]] | |||
* [[WinStopTimer]] | |||
== Related Messages == | |||
* [[QMSG]] | |||
[[Category:Win]] | [[Category:Win]] |
Latest revision as of 16:04, 15 May 2025
This function returns the message time for the last message retrieved by the WinGetMsg or WinPeekMsg functions from the current message queue.
Syntax
WinQueryMsgTime(hab);
Parameters
- hab (HAB) - input
- Anchor-block handle.
Returns
- ulTime (ULONG) - returns
- Time in milliseconds.
Remarks
The message time is the time the message is posted, measured in milliseconds, from the time the system is started. Its value is the same as that in the parameter of the QMSG structure.
To calculate time delays between messages, the time of the first message is subtracted from the time of the second message.
Time values do not always increase because the value is the number of milliseconds since the system was started, and the system accumulator for this count can wrap through zero.
Example Code
Declaration:
#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ ULONG ulTime; /* Time in milliseconds. */ ulTime = WinQueryMsgTime(hab);
This example returns position and time of the the last message obtained from the current message queue.
#define INCL_WINMESSAGEMGR #define INCL_WINDIALOGS #include <OS2.H> #include <stdio.h> HAB hab; POINTL ptl; CHAR szMsg[100]; HWND hwnd; ULONG ulTime; WinQueryMsgPos(hab, &ptl); ulTime = WinQueryMsgTime(hab); sprintf(szMsg, "x = %ld y = %ld\n\ntime = %ld", ptl.x, ptl.y, ulTime); WinMessageBox(HWND_DESKTOP, hwnd, /* client-window handle */ szMsg, /* body of the message */ "Debugging information", /* title of the message */ 0, /* message box id */ MB_NOICON | MB_OK); /* icon and button flags */