Jump to content

GpiQueryCp: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Returns the currently selected graphics code page.
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==
==Syntax==
<code>
  GpiQueryCp(hps)
  #define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>
HPS      hps;        /* Presentation-space handle */
ULONG    ulCodePage;  /* Code page */
ulCodePage = GpiQueryCp(hps);
</code>


==Parameter==
==Parameter==
;hps (HPS) - input:Presentation-space handle.
;hps (HPS) - input
;ulCodePage (ULONG) - returns Code page.
:Presentation-space handle.
:GPI_ERROR - Error
:Otherwise Code page.


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''.
==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==
<pre>
#define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>
 
HPS      hps;        /*  Presentation-space handle. */
ULONG    ulCodePage;  /*  Code page. */
 
ulCodePage = GpiQueryCp(hps);
</pre>
This example uses GpiQueryCp to return the currently selected graphics code page.
<pre>
#define INCL_GPILCIDS          /* Font functions              */
#include <os2.h>
 
ULONG  ulCodePage;      /* code page (or error)                */
HPS    hps;            /* Presentation-space handle            */
 
ulCodePage = GpiQueryCp(hps);
 
</pre>


[[Category:Gpi]]
[[Category:Gpi]]

Latest revision as of 19:45, 7 April 2025

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