summaryrefslogtreecommitdiff
path: root/demo/os2/getctry.pas
blob: 7c40e056099d760c55830ac5349cdc89b1af4c6c (plain)
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
{
    This file is part of the Free Pascal run time library.
    Copyright (c) 1993-2001 by Free Pascal team

    A little example of using OS/2 API calls.

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
program GetCountryInfo;

uses
 OS2Def, DosCalls;

var
 Country: TCountryCode;  (* Country code info (0 = current country) *)
 CtryInfo: TCountryInfo; (* Buffer for country-specific information *)
 Size: longint;         (* Real size of returned data              *)
 W: word;

begin
 WriteLn;
 Size := 0;
 FillChar (Country, SizeOf (Country), 0);
 FillChar (CtryInfo, SizeOf (CtryInfo), 0);
 W := DosQueryCtryInfo (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.