你知道如何判断系统的语言吗?(30分)

里斯

Unregistered / Unconfirmed
GUEST, unregistred user!
[^]请教如何判断系统当前的语言,如98有繁简体,Win2k也有繁简体,
并且简体系统有可能在繁体环境下工作,多谢。
 
不会吧,竟然没有个人回答
 
SysLocale.DefaultLCID

看看SysLocale的帮助,或者全文检索一下:SysLocale
 
没有高手了吗,好象不是很难的,为什么没人帮忙呀?
 
不知是不是这个函数:
GetSystemDefaultLangID
返回1021是繁体系统
1028是简体系统
其它值我不知道,我用是的这个笨办法。
 
use shellapi

LangID:integer;
Langid:=GetSystemDefaultLangID;
if Langid = $0804 then ...........
0x0404 Chinese (Taiwan)
0x0804 Chinese (PRC)
0x0c04 Chinese (Hong Kong)
0x0411 Japanese
0x0412 Korean
0x0409 English (United States)


 
[:)]我公司产品就有简体/繁体版本,给你点source参考吧
使用函数
UINT GetACP(VOID)

返回值
Identifier Meaning
874 Thai
932 Japan
936 Chinese (PRC, Singapore)
949 Korean
950 Chinese (Taiwan, Hong Kong)
1200 Unicode (BMP of ISO 10646)
1250 Windows 3.1 Eastern European
1251 Windows 3.1 Cyrillic
1252 Windows 3.1 Latin 1 (US, Western Europe)
1253 Windows 3.1 Greek
1254 Windows 3.1 Turkish
1255 Hebrew
1256 Arabic
1257 Baltic

代码:
var
nLang : integer;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ConfigLanguage(GetACP);
end;

procedure TForm1.ConfigLanguage(LID: integer);
begin
  nLang := LID;
  if nLang=936 then
  begin
    Form1.Font.Charset := GB2312_CHARSET;
    Form1.Font.Name := '宋体';
    Form1.Font.Size := 9;
    Application.Title := '定时关机';    
    Label5.Caption := '现在时间:';
    Label1.Caption := '定时时间:';
    Label7.Caption := '目标时间:';
    Label2.Caption := '小时';
    Label3.Caption := '分';
    Label4.Caption := '秒';
  end
  else if nLang=950 then
  begin
    Form1.Font.Charset := CHINESEBIG5_CHARSET;
    Form1.Font.Name := '灿?砰';
    Form1.Font.Size := 9;
    Application.Title := '﹚?闽诀';
    Label5.Caption := '瞷??丁:';
    Label1.Caption := '﹚??丁:';
    Label7.Caption := 'ヘ夹?丁:';
    Label2.Caption := '??';
    Label3.Caption := 'だ';
    Label4.Caption := '?';
  end
  else
  begin
    Form1.Font.Charset := ANSI_CHARSET;
    Form1.Font.Name := 'Arial';
    Form1.Font.Size := 9;
    Application.Title := 'AutoShutdown';
    Label5.Caption := 'Curr. Time';
    Label1.Caption := 'Delay Time';
    Label7.Caption := 'Dest. Time';
    Label2.Caption := 'Hour';
    Label3.Caption := 'Min.';
    Label4.Caption := 'Sec.';
  end;
end;
注意要将Form1中控件的ParentFont属性设为true
 
顶部