Jump to content

WinQueryMsgPos

From EDM2
Revision as of 21:47, 8 April 2025 by Martini (talk | contribs) (Created page with "This function ''returns the pointer position, in screen coordinates, when the last message obtained from the current message queue is posted''. ==Syntax== WinQueryMsgPos(hab, pptl) ==Parameters== ;hab (HAB) - Input: Anchor-block handle. ;pptl (PPOINTL) - Output: Pointer position in screen coordinates. ;rc (BOOL) - Returns: Success indicator. TRUE for success, FALSE for error. ==Returns== ;rc (BOOL) - returns :Success indicator. :;TRUE ::Successful complet...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the pointer position, in screen coordinates, when the last message obtained from the current message queue is posted.

Syntax

WinQueryMsgPos(hab, pptl)

Parameters

hab (HAB) - Input
Anchor-block handle.
pptl (PPOINTL) - Output
Pointer position in screen coordinates.
rc (BOOL) - Returns
Success indicator. TRUE for success, FALSE for error.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

The pointer position is the same as that in the parameter of a QMSG structure.

To obtain the current position of the pointer, use the WinQueryPointerPos function.

Example Code

#define INCL_WINMESSAGEMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HAB     hab;   /* Anchor-block handle. */
PPOINTL pptl;  /* Pointer position in screen coordinates. */
BOOL    rc;    /* Success indicator. */

rc = WinQueryMsgPos(hab, pptl);

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\n\ny = %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