Jump to content

WinQueryPointerInfo

From EDM2
Revision as of 03:25, 9 April 2025 by Martini (talk | contribs) (Created page with "This function ''returns pointer information''. ==Syntax== WinQueryPointerInfo(hptr, pptriPointerInfo) ==Parameters== ;hptr (HPOINTER) - Input : Pointer handle. ;pptriPointerInfo (PPOINTERINFO) - Output : Pointer-information structure. ==Returns== ;rc (BOOL) - returns : Success indicator. :;TRUE :: Successful completion :;FALSE :: Error occurred. ==Remarks== The pointer information structure contains information such as the bit-map handle of the pointer a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns pointer information.

Syntax

WinQueryPointerInfo(hptr, pptriPointerInfo)

Parameters

hptr (HPOINTER) - Input
Pointer handle.
pptriPointerInfo (PPOINTERINFO) - Output
Pointer-information structure.

Returns

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

Remarks

The pointer information structure contains information such as the bit-map handle of the pointer and action point coordinates. The values returned for the parameters are in units relative to the size of the system icon or system pointer. For example, if the application creates a pointer out of a bit map xWide units wide and positions the x-coordinate of the pointer's action point at xHot, then this function will return the value of the as:

xHotspot = (xHot * SystemPointerWidth) / xWide

where SystemPointerWidth can be obtained by using the WinQuerySysValue function.

Errors

Possible returns from WinGetLastError:

PMERR_INVALID_HPTR (0x101B)
An invalid pointer handle was specified.

Example Code

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

HPOINTER      hptr;             /*  Pointer handle. */
PPOINTERINFO  pptriPointerInfo; /*  Pointer-information structure. */
BOOL          rc;               /*  Success indicator. */

rc = WinQueryPointerInfo(hptr, pptriPointerInfo);

This example uses the WinQueryPointerInfo call to obtain the bit-map handle of the color bit map.

#define INCL_WINPOINTERS
#define INCL_WINDESKTOP
#include <OS2.H>

HAB         hab;
HPOINTER    hpointer;
POINTERINFO pointerinfo;
HBITMAP     hbm;             /* Bit-map handle of color bit map  */

hpointer = WinQueryPointer(HWND_DESKTOP);

WinQueryPointerInfo(hpointer,
                    &pointerinfo);

hbm = pointerinfo.hbmColor;

Related Functions