zoukankan      html  css  js  c++  java
  • delphi如何获得当前操作系统语言环境

    function GetWindowsLanguage: string;   
    var 
        WinLanguage: array [0..50] of char;   
    begin 
        VerLanguageName(GetSystemDefaultLangID, WinLanguage, 50);   
        Result := StrPas(WinLanguage);   
    end;   
    
    procedure TForm1.Button1Click(Sender: TObject);   
    begin 
        ShowMessage(GetWindowsLanguage);   
    end;   
    
    {********************************************************************} 
    { another code: 
    {********************************************************************} 
    
    function GetWindowsLanguage1(LCTYPE: LCTYPE {type of information}): string;   
    var 
        Buffer : PChar;   
        Size : integer;   
    begin 
        Size := GetLocaleInfo (LOCALE_USER_DEFAULT, LCType, nil, 0);   
        GetMem(Buffer, Size);   
        try 
        GetLocaleInfo (LOCALE_USER_DEFAULT, LCTYPE, Buffer, Size);   
        Result := string(Buffer);   
        finally 
        FreeMem(Buffer);   
        end;   
    end;   
    
    procedure TForm1.Button2Click(Sender: TObject);   
    begin 
        Caption := GetWindowsLanguage1(LOCALE_SABBREVLANGNAME);   
    (* 
        LOCALE_ILANGUAGE           { language id } 
        LOCALE_SLANGUAGE           { localized name of language } 
        LOCALE_SENGLANGUAGE        { English name of language } 
        LOCALE_SABBREVLANGNAME     { abbreviated language name } 
        LOCALE_SNATIVELANGNAME     { native name of language } 
    *) 
    end;
  • 相关阅读:
    LightOJ 1094
    hdu 2586
    hdu 5234
    hdu 2955
    LightOJ 1030 数学期望
    poj 1273
    CodeIgniter学习笔记(十五)——CI中的Session
    CodeIgniter学习笔记(十四)——CI中的文件上传
    CodeIgniter学习笔记(十三)——CI中的分页
    CodeIgniter学习笔记(十二)——CI中的路由
  • 原文地址:https://www.cnblogs.com/findumars/p/5061993.html
Copyright © 2011-2022 走看看