DosSetProcessCp

From EDM2
Jump to: navigation, search

Allows a process to set its code page.

Syntax

DosSetProcessCp(cp)

Parameters

cp (ULONG) - input 
A code page identifier.
Possible values are shown in the list.

Return Code

ulrc (APIRET) - returns
DosSetProcessCp returns one of the following values:
  • 0 NO_ERROR
  • 472 ERROR_INVALID_CODE_PAGE

Remarks

DosSetProcessCp sets the process code page of the calling process. The code page of a process is used in the following ways:

  1. The printer code page is set to the process code page through the file system and printer spooler (the system spooler must be installed) when the process makes a request to open the printer. Calling DosSetProcessCp does not affect the code page of a printer opened prior to the call, and does not affect the code page of a printer opened by another process.
  2. Country-dependent information, by default, is retrieved encoded in the code page of the calling process.
  3. A newly-created process inherits its process code page from its parent process.

DosSetProcessCp does not affect the display or keyboard code page.

Example Code

This example sets the code page of the process to 850.

#define INCL_DOSNLS       /* National Language Support values */
#define INCL_DOSERRORS    /* DOS Error values */
#include <os2.h>
#include <stdio.h>

int main(VOID) {
APIRET rc      = NO_ERROR;

rc = DosSetProcessCp(850);

if (rc != NO_ERROR) {
  printf("DosSetProcessCp error: return code = %u\n", rc);
  return 1;
}

return NO_ERROR;
}

Related Functions