Jump to content

WinStretchPointer: Difference between revisions

From EDM2
Created page with "This function draws a pointer in the passed '''hps''' at the passed coordinates '''lx''', '''ly''' and at the passed size '''lcx''', '''lcy'''. ==Syntax== WinStretchPointer(hps, lx, ly, lcx, lcy, hptrPointer, ulHalftone) ==Parameters== ;hps (HPS) - input : Presentation space handle into which the pointer is drawn. This can be either a micro presentation space or a normal presentation space (see GpiCreatePS). ;lx (LONG) - input : X coordinate at which to dr..."
 
 
Line 90: Line 90:
* [[WinQuerySysPointer]]
* [[WinQuerySysPointer]]
* [[WinQuerySysPointerData]]   
* [[WinQuerySysPointerData]]   
* [WinSetPointer]]
* [[WinSetPointer]]
* [[WinSetPointerPos]]
* [[WinSetPointerPos]]
* [[WinSetSysPointerData]]
* [[WinSetSysPointerData]]

Latest revision as of 17:14, 24 April 2025

This function draws a pointer in the passed hps at the passed coordinates lx, ly and at the passed size lcx, lcy.

Syntax

 WinStretchPointer(hps, lx, ly, lcx, lcy, hptrPointer, ulHalftone)

Parameters

hps (HPS) - input
Presentation space handle into which the pointer is drawn. This can be either a micro presentation space or a normal presentation space (see GpiCreatePS).
lx (LONG) - input
X coordinate at which to draw the pointer, in device coordinates.
ly (LONG) - input
Y coordinate at which to draw the pointer, in device coordinates.
lcx (LONG) - input
X size at which to draw the pointer, in device coordinates.
lcy (LONG) - input
Y size at which to draw the pointer, in device coordinates.
hptrPointer (HPOINTER) - input
Pointer handle. The pointer should be loaded using WinLoadPointer, WinCreatePointer, or WinCreatePointerIndirect.
ulHalftone (ULONG) - input
Shading control with which to draw the pointer:
DP_NORMAL: As it normally appears.
DP_HALFTONED: With a halftone pattern where black normally appears.
DP_INVERTED: Inverted-black for white, and white for black.

Returns

fSuccess (BOOL) - returns
Success indicator:
TRUE: Successful completion.
FALSE: The function failed.

Remarks

This function should only be used in draw mode (DM_DRAW) to a screen device context.

The function checks the supplied pointer to determine whether it contains a pointer format matching the size passed. If there is no such match the default format is stretched to size.

Errors

Possible returns from WinGetLastError:

PMERR_INVALID_HPTR (0x101B)
An invalid pointer handle was specified.
PMERR_INVALID_FLAG (0x1019)
An invalid bit was set for a parameter. Use constants defined by PM for options, and do not set any reserved bits.


Example Code

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

HPS      hps;         /* Presentation space handle into which the pointer is drawn. */
LONG     lx;          /* X coordinate at which to draw the pointer, in device coordinates. */
LONG     ly;          /* Y coordinate at which to draw the pointer, in device coordinates. */, in device coordinates. */
LONG     lcy;         /* Y size at which to draw the pointer, in device coordinates. */
HPOINTER hptrPointer; /* Pointer handle. */
ULONG    ulHalftone;  /* Shading control with which to draw the pointer: */
BOOL     fSuccess;    /* Success indicator: */

fSuccess = WinStretchPointer(hps, lx, ly,
                             lcx, lcy, hptrPointer, ulHalftone);

This example draws a pointer loaded using WinLoadPointer in response to a paint message (WM_PAINT).

#define INCL_WINPOINTERS               /* Window Pointer functions  */
#include <os2.h>

HPS      hps;                           /* Presentation-space handle */
HWND     hwnd;                          /* Window handle             */
HPOINTER hptr;                          /* Pointer handle            */
BOOL     fSuccess;                      /* Success indicator         */
ULONG    ulHalftone=DP_NORMAL;          /* Draw with normal shading  */
ULONG    idPointer=ID_MYPOINTER;        /* Identifier of pointer in  */
                                        /* executable resources    */

case WM_CREATE:
    hptr = WinLoadPointer(HWND_DESKTOP, NULLHANDLE, idPointer);

case WM_PAINT:
    hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
    WinStretchPointer(hps, 100, 100, 16, 16, hptr, ulHalftone);
    WinEndPaint(hps);

Related Functions