如何获取系统的语言(编码)就像IE 获取的编码一样? thanks 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以去访问注册表[HKEY_CLASSES_ROOT\MIME\Database\Codepage]下的每个节点的Description的值 谢谢,楼上。不过好像注册表中的CODEPAGE比IE中的编码来的多很多啊?比如日文,好像有5种。晕。 我已经知道怎么弄了。thanks! function GetCPInfoEx(CodePage: UINT;dwFlags: LongWord; var lpCPInfo: TCPInfoEx): BOOL; stdcall; external kernel32 name 'GetCPInfoExA';function EnumLocalesProc( lpLocaleString: PAnsiChar): Boolean;stdcall;var CodePage: LongWord; LocaleName: array[0..MAX_PATH] of char; str: String; lcp:TCPINFOEX;begin str := strpas(lpLocaleString); CodePage := StrToInt( str); GetCPInfoEx(CodePage,0,lcp); //WriteLogThreadsafe('c:\Locals.txt',String(lcp.CodePageName)+#13#10); ShowMessage(lcp.CodePageName); Result := true;end;EnumSystemCodePages(@EnumLocalesProc,CP_SUPPORTED); 用 GetOEMCP() 获取当前系统支持的非Unicode程序的语种。 用 GetOEMCP() 获取当前系统支持的非Unicode程序的字符编码。 报错:Undeclared identifier: 'TCPInfoEx' 抱歉,忘了Type _cpinfoexA = record MaxCharSize: LongWord; DefaultChar: Array[0..MAX_DEFAULTCHAR-1] of Byte; LeadByte: Array[0..MAX_LEADBYTES-1] of Byte; UnicodeDefaultChar: WideChar; CodePage: LongWord; CodePageName: Array[0..MAX_PATH-1] of AnsiChar; end; CPINFOEXA = _cpinfoexA; LPCPINFOEXA = ^CPINFOEXA; _cpinfoexW = record MaxCharSize: LongWord; DefaultChar: Array[0..MAX_DEFAULTCHAR-1] of Byte; LeadByte: Array[0..MAX_LEADBYTES-1] of Byte; UnicodeDefaultChar: WideChar; CodePage: LongWord; CodePageName: Array[0..MAX_PATH-1] of WideChar; end; CPINFOEXW = _cpinfoexW; LPCPINFOEXW = ^CPINFOEXW; CPINFOEX = CPINFOEXA; LPCPINFOEX = ^CPINFOEX; 谢谢,Delphi太强了。明天结贴。来者犹分。 EnumLocalesProc 这个怎么调用?能否详细解释一下,谢谢。 EnumSystemCodePages(@EnumLocalesProc,CP_SUPPORTED); 当前设定的语言,windows.GetACP 如何设置 IE宽带代理服务器的代理地址 查询某两个日期间的记录? 关于delphi连接数据库的问题!希望高手帮忙感激不尽! 谁有Enlib(DBGirdEH)的注册信息? 这样怎么会出错呢? VB,DELPHI 哪个对网络图形编程支持更好 TRcihEdit控件的Alignment属性运行是怎么改变不了呢? 请问在TClientSocket,TClientWinSocket中如何获得本机的名字? 一个时间转换的问题!!! 如何将QRExpr计算得到的数值返回给程序? 有谁知道TAdvancedScroller是什么控件里的类? DBNavigator 编辑数据,无法保存到数据库
[HKEY_CLASSES_ROOT\MIME\Database\Codepage]
下的每个节点的Description的值
不过好像注册表中的CODEPAGE比IE中的编码来的多很多啊?
比如日文,好像有5种。晕。
function GetCPInfoEx(CodePage: UINT;dwFlags: LongWord; var lpCPInfo: TCPInfoEx): BOOL; stdcall; external kernel32 name 'GetCPInfoExA';function EnumLocalesProc(
lpLocaleString: PAnsiChar
): Boolean;stdcall;
var
CodePage: LongWord; LocaleName: array[0..MAX_PATH] of char;
str: String;
lcp:TCPINFOEX;
begin
str := strpas(lpLocaleString);
CodePage := StrToInt( str);
GetCPInfoEx(CodePage,0,lcp);
//WriteLogThreadsafe('c:\Locals.txt',String(lcp.CodePageName)+#13#10);
ShowMessage(lcp.CodePageName);
Result := true;end;
EnumSystemCodePages(@EnumLocalesProc,CP_SUPPORTED);
Type
_cpinfoexA = record
MaxCharSize: LongWord;
DefaultChar: Array[0..MAX_DEFAULTCHAR-1] of Byte;
LeadByte: Array[0..MAX_LEADBYTES-1] of Byte;
UnicodeDefaultChar: WideChar;
CodePage: LongWord;
CodePageName: Array[0..MAX_PATH-1] of AnsiChar;
end;
CPINFOEXA = _cpinfoexA;
LPCPINFOEXA = ^CPINFOEXA; _cpinfoexW = record
MaxCharSize: LongWord;
DefaultChar: Array[0..MAX_DEFAULTCHAR-1] of Byte;
LeadByte: Array[0..MAX_LEADBYTES-1] of Byte;
UnicodeDefaultChar: WideChar;
CodePage: LongWord;
CodePageName: Array[0..MAX_PATH-1] of WideChar;
end;
CPINFOEXW = _cpinfoexW;
LPCPINFOEXW = ^CPINFOEXW; CPINFOEX = CPINFOEXA;
LPCPINFOEX = ^CPINFOEX;