RT
解决方案 »
- delphi能否判断是否已经登录到域
- 您好,我使用了ColorMatrix进行图像的反色,对于有些彩色图像是正确的,而有些则有一些噪点,能帮我诊断下吗?
- 想了解com,最好是有一个delphi下可以调试通过的编写的com代码
- 全部分数求助:在DBGrid控件中如何实现象Excel表中的对行自动编号及对指定列自动汇总。
- 如何写个发送EMAIL的程序?
- 讨论:关于clientsocket和serversocket,请有实际网络工作经验的朋友进来!!
- 关于用ado开发c/s的问题。
- 读不懂的语句
- 程序无法调试??!! 急◎#¥%※
- 怎样将位图的颜色转化为16色???
- delphi webbrowser 来自网页的消息 out of memory at line
- SQL替换问题
http://blog.csdn.net/bdmh/article/details/6069485
你自己去掉一层就可以了procedure TForm1.btn2Click(Sender: TObject);
var
// Source:string;
ole_index: OleVariant;
frame_dispatch,frame_dispatch2: IDispatch;
frame_win,frame_win2: IHTMLWindow2;
doc2,frame_doc,frame_doc2: IHTMLDocument2;
J:integer;
spDisp: IDispatch;
IDoc1,IDoc2: IHTMLDocument2;
ielc: IHTMLElementCollection ;
ihtml:IHTMLElement;
iane:IHTMLAnchorElement;
begin
ole_index:=1;//这里是主页面的第二个frame
doc2:=wb1.Document as IHTMLDocument2;
frame_dispatch := doc2.Frames.Item(ole_index);
if frame_dispatch <> nil then
begin
frame_win := frame_dispatch as IHTMLWindow2;
frame_doc := frame_win.Document;
frame_doc.QueryInterface(IHTMLDocument2,iDoc1);
mmo1.Lines.Add(frame_doc.Body.OuterHtml);
mmo1.Lines.Add('=======================================');
frame_dispatch2 := iDoc1.Frames.Item(0);//这里是上面第二个frame中的第一个frame,
if frame_dispatch2 <> nil then
begin
frame_win2 := frame_dispatch2 as IHTMLWindow2;
frame_doc2 := frame_win2.Document;
frame_doc2.QueryInterface(IHTMLDocument2,iDoc2);
mmo1.Lines.Add(frame_doc2.Body.OuterHtml);
ielc:=idoc2.Get_all;
for J:=0 to ielc.length-1 do
begin
Application.ProcessMessages;
spDisp := ielc.item(J, 0);
if SUCCEEDED(spDisp.QueryInterface(IHTMLAnchorElement ,iane))then
begin
if AnsiContainsText(iane.href,'你链接的关键词') then //http://www.xxx.com/pc.php pc.php就可以了
begin
ihtml:=ielc.item(J,0) as IHTMLElement;
ihtml.click;
Mmo1.Lines.Add('点击成功');
end;
end;
end;
end;
end;
end;这方法比较笨,你可以遍历所有frame或直接获取frame序号
没试过 跟据项目的需要 直接用 webbrowser1.navigate('超链接地址'),不管框架了