私は機能を持っています
procedure bgGetKeyboardLayoutList(List: TStrings);
var
AList : array [0..50] of Hkl;
AklName: array [0..255] of Char;
i: Longint;
begin
List.Clear;
for i := 0 to GetKeyboardLayoutList(SizeOf(AList), AList) - 1 do
begin
GetLocaleInfo(LoWord(AList[i]), LOCALE_SLANGUAGE, AklName, SizeOf(
AklName));
List.AddObject(AklName, Pointer(AList[i]));
end;
end;
関数が呼び出されます
procedure TDefaultInputMethod.Scan;
begin
bgGetKeyboardLayoutList(FSL);
end;
しかし、逆方向に SetLocaleInfo を使用しようとすると、成功コードがありません:
procedure TDefaultInputMethod.SetAsDefault(index: integer);
begin
ActivateKeyboardLayout(Hkl(FSL.Objects[index]), 0); //this line works
if SetLocaleInfo(LoWord(FSL.Objects[index]), LOCALE_SLANGUAGE, PChar(FSL[index])) then
ShowMessage('Uspeh')
else
begin
ShowMessage(IntToStr(GetLastError));
end;
end;
GetLasrError は 1004 を返します
よろしくお願いします