5,388
社区成员
发帖
与我相关
我的任务
分享
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;
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);