Jump to content

DosSetProcessCp

From EDM2
Revision as of 22:04, 1 December 2016 by Ak120 (talk | contribs)

Description

Allows a process to set its code page.

Syntax

#define INCL_DOSNLS
#include <os2.h>

ULONG    cp;    /* A code page identifier. */
APIRET   ulrc;  /* Return Code. */

ulrc = DosSetProcessCp(cp);

Parameters

cp (ULONG) - input
A code page identifier.
Possible values are shown in the list below:
437        United States 
850        Multilingual 
852        Latin 2 (Czechoslovakia, Hungary, Poland, Yugoslavia) 
857        Turkish 
860        Portuguese 
861        Iceland 
863        Canadian French 
865        Nordic 
932        Japan 
934        Korea 
936        People's Republic of China 
938        Taiwan 
942        Japan SAA 
944        Korea SAA 
946        People's Republic of China SAA 
948        Taiwan SAA 

Note: Code pages 932, 934, 936, 938, 942, 944, 946, and 948 are supported only with the Asian version of the operating system on Asian hardware.

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:

First, 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.

Second, country-dependent information, by default, is retrieved encoded in the code page of the calling process.

Third, 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