Показать сообщение отдельно
  #2  
Старый 08.10.2010, 11:42
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

узнать класс активного окна, имеющего клавиатурный фокус ввода:
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Mask;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    MaskEdit1: TMaskEdit;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
  hid, h: THandle;
  data: array [0..$ff] of Char;
  l: Integer;
  rct: TRect;
begin
  Label1.Caption:='';
  Label2.Caption:='';
  Label3.Caption:='';
  begin
    hid:=GetForegroundWindow;
    AttachThreadInput(GetCurrentThreadId, GetWindowThreadProcessId(hid, nil), True);
    h:=GetFocus;
    if h>0 then
    begin
      l:=GetClassName(h, data, $100);
      if l>0 then Label1.Caption:=Copy(data, 1, l);
      if Windows.GetClientRect(h, rct) then
        Label2.Caption:=IntToStr(rct.Left)+','+IntToStr(rct.Top)+'/'+IntToStr(rct.Right)+','+IntToStr(rct.Bottom);
      l:=GetWindowText(h, data, $100);
      if l>0 then Label3.Caption:=Copy(data, 1, l);
    end;
    AttachThreadInput(GetCurrentThreadId, GetWindowThreadProcessId(hid, nil), False);
  end;
end;

end.

http://data.cod.ru/70523

а уж мигает в нем что-то или нет...
__________________
Пишу программы за еду.
__________________
Ответить с цитированием