1,183
社区成员
发帖
与我相关
我的任务
分享
EnumSystemLocalesEx(@EnumLocalesProcEx,0,0,nil);
function EnumLocalesProcEx(pLocaleString: PWideChar; dwFlags: DWORD; lParam: LPARAM):boolean; stdcall;
var
LCID,m:integer;
Buffer:array[0..255] of widechar;
S:string;
function SearchIndex(S:String):integer;
var Found:boolean;
begin
Result:=0;Found:=false;
while (Result<ListLocales.Count) and not(Found) do begin
if Uppercase(SansAccent(S))<UpperCase(SansAccent(ListLocales[Result])) then Found:=true else inc(Result);
end;
end;
begin
try
Result:=true;
LCID:=LocaleNameToLCID(pLocaleString,0);
FillChar(Buffer,SizeOf(Buffer),0);
GetLocaleInfoEx(pLocaleString,LOCALE_IDEFAULTANSICODEPAGE,Buffer,SizeOf(Buffer));
Application.MessageBox(PChar(WideCharToString(pLocaleString)),'1');
//if CP=StrToIntDef(Buffer,0) then begin
FillChar(Buffer,SizeOf(Buffer),0);
GetLocaleInfoEx(pLocaleString,LOCALE_SLANGUAGE,Buffer,SizeOf(Buffer));
Application.MessageBox(PChar(WideCharToString(Buffer)),'2');
//tri par ordre alphabétique ListLocales avec synchro ListIdLangages
s := WideCharToString(Buffer);
Application.MessageBox(PChar(s),'3');
m:=SearchIndex(s);
ListLocales.Insert(m,s);
ListIdLangages.Insert(m,IntToStr(LCID));
//end;
except
Application.MessageBox('exception','4');
//Result:=false;
end;
end;