13-08-2010, 02:10 AM
إقتباس :ضع أمر إستخراج اللغة في Timerيمكن اقتناص الحدث WM_INPUTLANGCHANGE المخصص لذلك كما يلي:
PHP كود :
procedure WMInputLangChange(var wMsg: TMessage); message WM_INPUTLANGCHANGE;
PHP كود :
procedure TForm1.WMInputLangChange(var wMsg: TMessage);
begin
ShowMessage(Format('Keyboard Layout: %8.8x', [LoWord(GetKeyboardLayout(GetCurrentThreadId))]));
inherited;
end;
لذلك يفضل إرسال الحدث إلى التطيبق (TApplication). واقتناص WM_INPUTLANGCHANGEREQUEST أفضل كما يلي:
PHP كود :
private
procedure WndProc(var wMsg: TMsg; var Handled: Boolean);
...
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := WndProc;
end;
procedure TForm1.WndProc(var wMsg: TMsg; var Handled: Boolean);
begin
if wMsg.message = WM_INPUTLANGCHANGEREQUEST then
ShowMessage(Format('Keyboard Layout: %8.8x', [LoWord(GetKeyboardLayout(GetCurrentThreadId))]));
end;

