Jump to content

WinDestroyPointer

From EDM2
Revision as of 21:43, 6 August 2023 by Martini (talk | contribs) (Created page with " This function destroys a pointer or icon. ==Syntax== WinDestroyPointer(hptrPointer); ==Parameters== ;hptrPointer (HPOINTER) - input :Handle of pointer to be destroyed. ==R...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function destroys a pointer or icon.

Syntax

WinDestroyPointer(hptrPointer);

Parameters

hptrPointer (HPOINTER) - input
Handle of pointer to be destroyed.

Returns

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

Errors

Possible returns from WinGetLastError

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

Remarks

A pointer can only be destroyed by the thread that created it.

The system pointers and icons must not be destroyed.

Example Code

This example destroys a bit-map pointer, created by either WinCreatePointer or WinCreatePointerIndirect, once the window has received a close message (WM_CLOSE).

#define INCL_WINPOINTERS        /* Window Pointer Functions     */
#define INCL_GPIBITMAPS         /* Graphics Bit-map Functions    */
#include <os2.h>
#define IDP_BITMAP 1

HPS   hps;              /* presentation-space handle            */
HWND  hwnd;             /* window handle                        */
HPOINTER  hptr;         /* bit-map pointer handle               */
HBITMAP  hbm;           /* bit-map handle                       */
BOOL  fSuccess;         /* success indicator                    */

case WM_CREATE:
     hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
     hbm = GpiLoadBitmap(hps, 0L, IDP_BITMAP, 64L, 64L);
     WinEndPaint(hps);

     hptr = WinCreatePointer(HWND_DESKTOP, hbm,
                             TRUE, /* use true (system) pointer */
                             0, 0); /* hot spot offset (0,0)    */


case WM_CLOSE:
     fSuccess = WinDestroyPointer(hptr);

Definition

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

HPOINTER    hptrPointer;  /*  Handle of pointer to be destroyed. */
BOOL        rc;           /*  Success indicator. */

rc = WinDestroyPointer(hptrPointer);

Related Functions

  • WinCreatePointer
  • WinCreatePointerIndirect
  • WinDrawPointer
  • WinLoadPointer
  • WinQueryPointer
  • WinQueryPointerInfo
  • WinQueryPointerPos
  • WinQuerySysPointer
  • WinQuerySysPointerData
  • WinSetPointer
  • WinSetPointerPos
  • WinSetSysPointerData
  • WinShowPointer