Jump to content

GpiQueryCp

From EDM2
Revision as of 19:45, 7 April 2025 by Iturbide (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the currently selected graphics code page. It is used to retrieve the current presentation space (PS) character position (CP). The CP is a logical position within the PS that specifies the location where text or other graphical objects will be drawn.

Syntax

GpiQueryCp(hps)

Parameter

hps (HPS) - input
Presentation-space handle.

Returns

ulCodePage (ULONG) - returns
Code page.
GPI_ERROR
Error
Otherwise
Code page.

Errors

Possible returns from WinGetLastError

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.

Remarks

The code page identity returned is the one that is set by GpiSetCp (or defaulted when the presentation space is first created). This is the code page of the default font, not the currently-selected font, found from GpiQueryFontMetrics.

Example Code

#define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS      hps;         /*  Presentation-space handle. */
ULONG    ulCodePage;  /*  Code page. */

ulCodePage = GpiQueryCp(hps);

This example uses GpiQueryCp to return the currently selected graphics code page.

 
#define INCL_GPILCIDS           /* Font functions               */
#include <os2.h>

ULONG  ulCodePage;      /* code page (or error)                 */
HPS    hps;             /* Presentation-space handle            */

ulCodePage = GpiQueryCp(hps);