unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Memo1: TMemo;
Label6: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure getmousehandle(sender:tpoint);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
var
rpos:tpoint;
begin
if boolean(getcursorpos(rpos)) then
getmousehandle(rpos);
end;
procedure tform1.getmousehandle(sender:tpoint);
var hwnd:thandle;
aname:array[0..255] of char;
gwlid,l:integer;
ss
char;
begin
label4.Caption:='X:'+inttostr(sender.x);
label5.Caption:='Y:'+inttostr(sender.y);
hwnd:=windowfrompoint(sender);
sendmessage(hwnd,WM_GETTEXTLENGTH,0,l);
inc(l);
getmem(ss,l);
sendmessage(hwnd,WM_GETTEXT,l,longint(lpstr(ss)));
memo1.Lines.clear;
if hwnd<>memo1.handle then
memo1.Lines.Append(string(ss));
freemem(ss,0);
label1.Caption:='Handle:'+inttostr(hwnd);
if boolean(getclassname(hwnd,aname,256)) then
label2.Caption:='Classname:'+string(aname)
else
label2.Caption:='classname not found!';
gwlid:=getwindowlong(hwnd,GWL_ID);
label3.Caption:='ID:'+inttostr(gwlid);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Interval:=50;
end;
end.