5,386
社区成员
发帖
与我相关
我的任务
分享
function CheckIfKeyboardInstalled(aId_Langage:integer):boolean;
var Id_KbLayout,Hkl:integer;
begin
if GetOSVersion<>'NT4.0' then begin
Result:=false;
Id_KbLayout:=(SORT_DEFAULT shl 16) or aId_Langage;
Hkl:=LoadKeyboardLayout(PChar(IntToHex(Id_KbLayout,8)),KLF_ACTIVATE);
if Hkl>0 then begin
Result:=true;
UnloadKeyboardLayout(Hkl);
end;
end
else Result:=true;
end;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,TypInfo;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
cbbUserLangauge: TComboBox;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i ,j: integer;
vForm : TForm;
begin
for j := 0 to Screen.FormCount -1 do
begin
vForm := Screen.Forms[j];
for i := 0 to vForm.ComponentCount -1 do begin
if getPropInfo(vForm.Components[i],'imeName') <> nil then begin
SetPropValue(vForm.Components[i],'imeName',cbbUserLangauge.Text);
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
j: integer;
begin
with cbbUserLangauge do
begin
Clear;
for j := 0 to screen.imes.count - 1 do
begin
Items.Add(screen.Imes.strings[j]);
end;
end;
end;
end.