GreSetCodePage

From EDM2
Jump to: navigation, search

GreSetCodePage sets the current code page for characters written with the base (default) font.

This function must be supported by the presentation driver. GreSetCodePage is called by GpiSetCP in response to an application requesting to change the currently selected code page for the device context.

Simulation support
None. This function is mandatory for all drivers.

Syntax

GreSetCodePage(hdc, lCodePage, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
lCodePage (ULONG) - input
New code page.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreSetCodePage.

Return Code

rc (BOOL) - returns
Return codes.
On completion, the handling routine must return a BOOLEAN value to indicate success or an error.
  • TRUE Successful
  • FALSE Error
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_EXCEEDS_MAX_SEG_LENGTH
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_CODEPAGE
  • PMERR_INV_HDC
  • PMERR_INV_IN_AREA
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Remarks

The default is the font that the system uses when the cbnd_Set attribute is hex 0000. (See Character Attributes.) When the base font is not in use, lCodePage is saved until required. When a DC is initialized, the code page is set to the default code page obtained from WinQueryProcessCp.

#define INCL_GRE_DEVMISC3
#include <os2.h>

HDC      hdc;        /*  Device context handle. */
ULONG    lCodePage;  /*  New code page. */
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreSetCodePage. */
BOOL     rc;         /*  Return codes. */

rc = GreSetCodePage(hdc, lCodePage, pInstance, lFunction);