Jump to content

DosSetProcessCp: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
==Description==
Allows a process to set its code page.
Allows a process to set its code page.


==Syntax==
==Syntax==
<PRE>
  DosSetProcessCp(cp)
#define INCL_DOSNLS
#include <os2.h>
 
ULONG    cp;    /* A code page identifier. */
APIRET  ulrc; /* Return Code. */
 
ulrc = DosSetProcessCp(cp);
</PRE>


==Parameters==
==Parameters==
;cp (ULONG) - input : A code page identifier.
;cp (ULONG) - input : A code page identifier.
:Possible values are shown in the list below:
:Possible values are shown in the [[Code pages|list]].
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==
==Return Code==
ulrc (APIRET) - returns
;ulrc (APIRET) - returns:DosSetProcessCp returns one of the following values:
DosSetProcessCp returns one of the following values:
*0 NO_ERROR
* 0 NO_ERROR
*472 ERROR_INVALID_CODE_PAGE
*472 ERROR_INVALID_CODE_PAGE


==Remarks==
==Remarks==
DosSetProcessCp sets the process code page of the calling process. The code page of a process is used in the following ways:
DosSetProcessCp sets the process code page of the calling process. The code page of a process is used in the following ways:
 
# 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.
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.
# Country-dependent information, by default, is retrieved encoded in the code page of the calling process.
 
# A newly-created process inherits its process code page from its parent 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.  
DosSetProcessCp does not affect the display or keyboard code page.  



Latest revision as of 17:18, 12 October 2018

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