1 頁 (共 1 頁)

GetLocaleInfo的使用

發表於 : 2008年 11月 27日, 18:30
tim
參考資料:
http://forum.nifty.com/fdelphi/samples/00390.html

代碼: 選擇全部

     
    function GetLocaleString(lctp: LCTYPE): String; 
    var 
      j: Integer; 
      s: String; 
    begin 
      j := GetLocaleInfo(GetSystemDefaultLCID, lctp, PChar(nil), 0); 
      SetLength(s, j); 
      GetLocaleInfo(GetSystemDefaultLCID, lctp, PChar(s), j); 
      SetLength(s, j-1); 
      Result := s; 
    end; 
     
     
     
    procedure Tform1.Button1Click(Sender: TObject); 
    begin 
      showmessage(GetLocaleString(LOCALE_ILANGUAGE)); 
      showmessage(GetLocaleString(LOCALE_SLANGUAGE)); 
      showmessage(GetLocaleString(LOCALE_SENGLANGUAGE)); 
      showmessage(GetLocaleString(LOCALE_SABBREVLANGNAME)); 
      showmessage(GetLocaleString(LOCALE_SNATIVELANGNAME)); 
    end;