//取得当前IE中地址栏信息,其它的可类推
function Tfrm_main.GetCurrentIEAddress:String;
var
ClassName: PChar;
atCursor: TPoint;
hWndMouseOver: HWND;
Text: PChar;
begin
Result :=False;
atCursor.x :=400; //IE地址栏位置
atCursor.y :=105;
hWndMouseOver:=WindowFromPoint(atCursor);
GetMem(ClassName, 100);
GetMem(Text, 255);
try
GetClassName(hWndMouseOver, ClassName, 100);
if String(ClassName)='Edit' then
Begin
SendMessage(hWndMouseOver, WM_GETTEXT, 255, LongInt(Text));
Result :=String(Text);
end;
finally
FreeMem(ClassName);
FreeMem(Text);
end;
end;
function Tfrm_main.GetCurrentIEAddress:String;
var
ClassName: PChar;
atCursor: TPoint;
hWndMouseOver: HWND;
Text: PChar;
begin
Result :=False;
atCursor.x :=400; //IE地址栏位置
atCursor.y :=105;
hWndMouseOver:=WindowFromPoint(atCursor);
GetMem(ClassName, 100);
GetMem(Text, 255);
try
GetClassName(hWndMouseOver, ClassName, 100);
if String(ClassName)='Edit' then
Begin
SendMessage(hWndMouseOver, WM_GETTEXT, 255, LongInt(Text));
Result :=String(Text);
end;
finally
FreeMem(ClassName);
FreeMem(Text);
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货