1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
program GetCountryInfo;
{$IFNDEF OS2}
Sorry, this code is for OS/2 only...
{$ENDIF}
uses
{$IFDEF FPC}
DosCalls;
{$ELSE}
Os2Def,
{$IFDEF SPEED}
BseDos;
{$ELSE}
DosProcs, DosTypes;
{$ENDIF}
{$ENDIF}
type
cardinal = longint;
{$IFDEF FPC}
const
NO_ERROR = 0;
{$ENDIF}
var
{$IFDEF VER70} (* patched Borland Pascal *)
Country: TCountryCode;
CtryInfo: TCountryInfo;
Size: longint;
{$ELSE}
Country: COUNTRYCODE; (* Country code info (0 = current country) *)
CtryInfo: COUNTRYINFO; (* Buffer for country-specific information *)
Size: cardinal; (* Real size of returned data *)
{$ENDIF}
W: word;
begin
WriteLn;
Size := 0;
FillChar (Country, SizeOf (Country), 0);
FillChar (CtryInfo, SizeOf (CtryInfo), 0);
W :=
{$IFDEF VER70}
DosGetCtryInfo
{$ELSE}
DosQueryCtryInfo
{$ENDIF}
(SizeOf (CtryInfo), Country, CtryInfo, Size);
if (W <> NO_ERROR) then
begin
WriteLn ('DosQueryCtryInfo error: return code = ', W);
Halt (1);
end;
WriteLn ('Code of the country is ', CtryInfo.Country,
', current codepage is ', CtryInfo.CodePage);
end.
|