Jump to content

WinDestroyPointer: Difference between revisions

From EDM2
Created page with " This function destroys a pointer or icon. ==Syntax== WinDestroyPointer(hptrPointer); ==Parameters== ;hptrPointer (HPOINTER) - input :Handle of pointer to be destroyed. ==R..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function destroys a pointer or icon.


This function destroys a pointer or icon.
==Syntax==
==Syntax==
  WinDestroyPointer(hptrPointer);
  WinDestroyPointer(hptrPointer)


==Parameters==
==Parameters==
;hptrPointer (HPOINTER) - input
;hptrPointer (HPOINTER) - input:Handle of pointer to be destroyed.
:Handle of pointer to be destroyed.
 
==Returns==
==Returns==
;rc (BOOL) - returns
;rc (BOOL) - returns:Success indicator.
:Success indicator.
::TRUE: Successful completion
:;TRUE
::FALSE: Error occurred.
::Successful completion  
:;FALSE
::Error occurred.


==Errors==
==Errors==
Possible returns from WinGetLastError
Possible returns from WinGetLastError
;PMERR_INVALID_HPTR (0x101B)
;PMERR_INVALID_HPTR (0x101B):An invalid pointer handle was specified.
:An invalid pointer handle was specified.
 
==Remarks==
==Remarks==
A pointer can only be destroyed by the thread that created it.
A pointer can only be destroyed by the thread that created it.


The system pointers and icons must not be destroyed.  
The system pointers and icons must not be destroyed.
 
==Example Code==
==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).
This example destroys a bit-map pointer, created by either WinCreatePointer or WinCreatePointerIndirect, once the window has received a close message (WM_CLOSE).
Line 49: Line 47:
case WM_CLOSE:
case WM_CLOSE:
     fSuccess = WinDestroyPointer(hptr);
     fSuccess = WinDestroyPointer(hptr);
</pre>
Definition
<pre>
#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);
</pre>
</pre>



Latest revision as of 07:31, 7 August 2023

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);

Related Functions

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