14-03-2016, 02:02 PM
14-03-2016, 05:15 PM
وعليكم السلام ورحمة الله وبركاته :
الدالة الأولى GetKLList تقوم بجلب قائمة اللغات المثبة على جهازك.
في الحدث OnCreate للفورم الرئيسي ، نقوم بتعبئة ListBox بقائمة اللغات ، قم أنت بتغيير ListBox إلى ComboBox .
و هذا هو الكود.
الدالة الأولى GetKLList تقوم بجلب قائمة اللغات المثبة على جهازك.
في الحدث OnCreate للفورم الرئيسي ، نقوم بتعبئة ListBox بقائمة اللغات ، قم أنت بتغيير ListBox إلى ComboBox .
و هذا هو الكود.
كود :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure GetKLList(List: TStrings);
var
AList : array [0..9] 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 TForm1.FormCreate(Sender: TObject);
begin
GetKLList(ListBox1.Items);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
with Sender as TListBox do
ActivateKeyboardLayout(Hkl(Items.Objects[ItemIndex]), 0);
end;
end.14-03-2016, 07:20 PM
بارك الله فيك شغال 100%