попробую в 3-ий раз показать) уже программа целиком:
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
hForegroundWindow: THandle;
idProcess: DWORD;
kbl: Cardinal;
begin
hForegroundWindow:=GetForegroundWindow;
idProcess:=GetWindowThreadProcessId(hForegroundWindow);
kbl:=LOWORD(GetKeyboardLayout(idProcess));
case kbl of
$409: Label1.Caption:='Английский';
$419: Label1.Caption:='Русский';
else Label1.Caption:='Неизвестный';
end;
end;
end.
не важно активно окно программы или нет - в любом случае показывает язык ввода активного окна.