如果IE已经打开
直接找到文本框句柄
然后settext应该可以
下面代码没测试过,是通过取得IE地址修改而来的
你看看可以吗?
var
Form1: TForm1;
implementation
{$R *.DFM}
Function SetURL(H:hwnd;lparam:longint):boolean;stdcall;
var str,url:array [0..254] of char;
begin
getclassname(h,@str,255);
if strpas(@str)='ComboBoxEx32' then // ComboBoxEx32可以改成Edit.
SendMessage(h,WM_SETTEXT,255,LongInt(@url));
result:=true;
end;
function callbackproc(H:HWnd;lparam:longint):Boolean;stdcall;
var str:array [1..255] of char;
begin
getclassname(h,@str,255);
if ((strpas(@str)='CabinetWClass') or (strpas(@str)='IEFrame')) then
begin
Enumchildwindows(h,@SetURL,0);
end;
result:=true;
end;
procedure TForm1.findbuttonClick(Sender: TObject);
begin
Enumwindows(@callbackproc,0);
end;