正做一个登录系统,需要记录网页登录信息。现在想法如下:在系统里面添加一个WebBrowser的控件,然后,我打开IE浏览器,打开如www.163.com这种登录页面。
我想FindWindow('IEFrame',nil)(不知道是不是用FindWindow('Internet Explorer_Server',nil)更好)来返回一个HWND,然后怎么把这个HWND传给WebBrowser呢()?是不是上面这个方法根本不行呢?这段代码是获取WebBrowser打开的网页里面的form的,添加到listbox1。 现在我就像打开ie浏览器,而我的程序能获得浏览器正在浏览的网页的form,应该怎么做呢?? 大家帮帮忙啊,嫌分少可以再加!!procedure TForminsertweb.BitBtn1Click(Sender: TObject);
var
doc:IHTMLDocument2;
all:IHTMLElementCollection;
len,i:integer;
item:OleVariant;
form_name:widestring;
begin
listbox1.Items.clear;listbox2.Items.clear;
doc:=WebBrowser1.Document as IHTMLDocument2;
Try
if (doc<>nil) and (not WebBrowser1.busy) then
begin
all:=doc.Get_Forms;//doc.Links亦可
len:=all.length;
for i:=0 to len-1 do
begin
item:=all.item(i,varempty);
form_name:=item.name;
if (form_name='[object]') or (form_name='') then listbox2.Items.add('->'+item.action)
else listbox2.Items.add(form_name+'->'+item.action);
end;
end;
except
MessageBox(application.Handle, '对不起,部分表单信息获取出现错误!' , '提示信息' ,MB_ICONWARNING);
end;
end;
我想FindWindow('IEFrame',nil)(不知道是不是用FindWindow('Internet Explorer_Server',nil)更好)来返回一个HWND,然后怎么把这个HWND传给WebBrowser呢()?是不是上面这个方法根本不行呢?这段代码是获取WebBrowser打开的网页里面的form的,添加到listbox1。 现在我就像打开ie浏览器,而我的程序能获得浏览器正在浏览的网页的form,应该怎么做呢?? 大家帮帮忙啊,嫌分少可以再加!!procedure TForminsertweb.BitBtn1Click(Sender: TObject);
var
doc:IHTMLDocument2;
all:IHTMLElementCollection;
len,i:integer;
item:OleVariant;
form_name:widestring;
begin
listbox1.Items.clear;listbox2.Items.clear;
doc:=WebBrowser1.Document as IHTMLDocument2;
Try
if (doc<>nil) and (not WebBrowser1.busy) then
begin
all:=doc.Get_Forms;//doc.Links亦可
len:=all.length;
for i:=0 to len-1 do
begin
item:=all.item(i,varempty);
form_name:=item.name;
if (form_name='[object]') or (form_name='') then listbox2.Items.add('->'+item.action)
else listbox2.Items.add(form_name+'->'+item.action);
end;
end;
except
MessageBox(application.Handle, '对不起,部分表单信息获取出现错误!' , '提示信息' ,MB_ICONWARNING);
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货