Jump to content

WinQueryMsgTime: Difference between revisions

From EDM2
No edit summary
No edit summary
 
Line 1: Line 1:
Returns the time in milliseconds when the last message retrieved from the queue was posted.
This function returns the message time for the last message retrieved by the [[WinGetMsg]] or [[WinPeekMsg]] functions from the current message queue.


==Syntax==
== Syntax ==
WinQueryMsgTime(hab)
<pre>
WinQueryMsgTime(hab);
</pre>


==Parameter==
== Parameters ==
;hab ([[HAB]]):handle to anchor-block
;''hab'' ([[HAB]]) - input: Anchor-block handle.


;Returns
== Returns ==
ULONG
;''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]]
[[Category:WorkToDo]]

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 */

Related Functions

Related Messages