J
jbas
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码是用来获取鼠标当前的窗口句柄,所属类别及获取里面的内容,不知对你有用吗?
procedure TForm1.Timer1Timer(Sender: TObject);
var
; className: PChar;
; atCursor: TPoint;
; hWndMouseOver: HWND;
; text: PChar;
; L:integer;
begin
; GetCursorPos(atCursor);
; hWndMouseOver:=WindowFromPoint(atCursor);
; GetMem(ClassName, 100);
; getmem(text,255);
; try
; ; GetClassName(hWndMouseOver, ClassName, 100);
; ; GetWindowText(hwndmouseover,text,L);
; ; Label_ClassName.Caption:='所属类名: '+String(ClassName);
; ; Edit1.Text:=String(text);
; finally
; ; FreeMem(ClassName);
; ; FreeMem(Text);
; end;
end;
end.
祝好运!
procedure TForm1.Timer1Timer(Sender: TObject);
var
; className: PChar;
; atCursor: TPoint;
; hWndMouseOver: HWND;
; text: PChar;
; L:integer;
begin
; GetCursorPos(atCursor);
; hWndMouseOver:=WindowFromPoint(atCursor);
; GetMem(ClassName, 100);
; getmem(text,255);
; try
; ; GetClassName(hWndMouseOver, ClassName, 100);
; ; GetWindowText(hwndmouseover,text,L);
; ; Label_ClassName.Caption:='所属类名: '+String(ClassName);
; ; Edit1.Text:=String(text);
; finally
; ; FreeMem(ClassName);
; ; FreeMem(Text);
; end;
end;
end.
祝好运!