Re: Delphi: get Windows language


[ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by webmaster Guido on November 26, 2001 at 21:17:09:

In Reply to: get Windows language posted by Stefan Loeners p12167 on November 20, 2001 at 12:37:30:

: How would I find out programmatically which language version of Windows NT is installed?

-----------

For Windows 98 and Me (I suppose it's the same for Win2000 and XP), you can get the system's language ID by means of the Win-API function GetSystemDefaultLangID. Next, use the Win-API function VerLanguageName to derive the language-string from the language ID. Example: the following code puts Windows' default language in a label:

procedure TForm1.Button1Click(Sender: TObject);
var 
  ID: LangID; 
  Language: array [0..100] of char; 
begin 
  ID := GetSystemDefaultLangID; 
  VerLanguageName(ID, Language, 100); 
  Label1.Caption := String(Language); 
end;

 


[ DelphiLand FAQ ]