getctry.pas 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993-2001 by Free Pascal team
  5. A little example of using OS/2 API calls.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. program GetCountryInfo;
  13. uses
  14. OS2Def, DosCalls;
  15. var
  16. Country: TCountryCode; (* Country code info (0 = current country) *)
  17. CtryInfo: TCountryInfo; (* Buffer for country-specific information *)
  18. Size: longint; (* Real size of returned data *)
  19. W: word;
  20. begin
  21. WriteLn;
  22. Size := 0;
  23. FillChar (Country, SizeOf (Country), 0);
  24. FillChar (CtryInfo, SizeOf (CtryInfo), 0);
  25. W := DosQueryCtryInfo (SizeOf (CtryInfo), Country, CtryInfo, Size);
  26. if (W <> NO_ERROR) then
  27. begin
  28. WriteLn ('DosQueryCtryInfo error: return code = ', W);
  29. Halt (1);
  30. end;
  31. WriteLn ('Code of the country is ', CtryInfo.Country,
  32. ', current codepage is ', CtryInfo.CodePage, '.');
  33. end.
  34. {
  35. $Log$
  36. Revision 1.3 2002-09-07 15:06:35 peter
  37. * old logs removed and tabs fixed
  38. Revision 1.2 2002/02/25 21:33:04 carl
  39. * bugfix of demo compilation problem
  40. }