Jump to content

WinQueryMsgTime

From EDM2
Revision as of 16:04, 15 May 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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