我用下句:webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext
去取得含框架网页的框架中的内容时,因为框架中显示的为.cgi等含post数据的网页(如:http://www.PostalPennies.com/cgi-bin/[email protected])而被EoleException类拒绝访问,无法操作该框架,无法取得该框架的内容。谁能帮我解决这个问题,分不够可加!我用的是Delphi7.0,代码也在Delphi6.0上试过。除了取得框架中的内容,我还要能用Onclick去点击框架内网页中的连接。网页框架的源码如下:
<frameset rows="0,*,60" framespacing="0" frameborder="0" border="0"><frame name="stats" frameborder="0" scrolling="Auto" noresize marginwidth="0" marginheight="0" border="0">
<frame src="http://www.PostalPennies.com/cgi-bin/[email protected]" name="newurl" frameborder="0" scrolling="Yes" marginwidth="0" marginheight="0" border="0">
<frame src="http://www6.tasiaspaidlinks.com/tpl/click-waitforcredit.cfm?serial=29376475&paidclicks=213&[email protected]" name="waitforcredit" frameborder="0" scrolling="Auto" marginwidth="0" marginheight="0" border="0">
</frameset>程序源码如下:unit temp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, dblookup, ExtCtrls, mshtml;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
ComboBox1: TComboBox;
Panel1: TPanel;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure WebBrowser1NewWindow2(Sender: TObject; var ppDisp: IDispatch;
var Cancel: WordBool);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate(combobox1.text);
end;procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
doc:ihtmldocument2;
begin
memo1.Lines.add(inttostr(webbrowser1.oleobject.document.documentelement.document.frames.length));
for i:=0 to doc.frames.length-1 do
begin
memo1.Lines.add(inttostr(i));
memo1.Lines.add(webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext);
end;
end;
end.另外:
为什么我用:
initialization
oleinitialize(nil);
finalization
try
oleuninitialize;
except
end;
去初始化而不能编译,出错信息为:
不能识别oleinitialize
不能识别oleuninitialize
去取得含框架网页的框架中的内容时,因为框架中显示的为.cgi等含post数据的网页(如:http://www.PostalPennies.com/cgi-bin/[email protected])而被EoleException类拒绝访问,无法操作该框架,无法取得该框架的内容。谁能帮我解决这个问题,分不够可加!我用的是Delphi7.0,代码也在Delphi6.0上试过。除了取得框架中的内容,我还要能用Onclick去点击框架内网页中的连接。网页框架的源码如下:
<frameset rows="0,*,60" framespacing="0" frameborder="0" border="0"><frame name="stats" frameborder="0" scrolling="Auto" noresize marginwidth="0" marginheight="0" border="0">
<frame src="http://www.PostalPennies.com/cgi-bin/[email protected]" name="newurl" frameborder="0" scrolling="Yes" marginwidth="0" marginheight="0" border="0">
<frame src="http://www6.tasiaspaidlinks.com/tpl/click-waitforcredit.cfm?serial=29376475&paidclicks=213&[email protected]" name="waitforcredit" frameborder="0" scrolling="Auto" marginwidth="0" marginheight="0" border="0">
</frameset>程序源码如下:unit temp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, dblookup, ExtCtrls, mshtml;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
ComboBox1: TComboBox;
Panel1: TPanel;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure WebBrowser1NewWindow2(Sender: TObject; var ppDisp: IDispatch;
var Cancel: WordBool);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate(combobox1.text);
end;procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
doc:ihtmldocument2;
begin
memo1.Lines.add(inttostr(webbrowser1.oleobject.document.documentelement.document.frames.length));
for i:=0 to doc.frames.length-1 do
begin
memo1.Lines.add(inttostr(i));
memo1.Lines.add(webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext);
end;
end;
end.另外:
为什么我用:
initialization
oleinitialize(nil);
finalization
try
oleuninitialize;
except
end;
去初始化而不能编译,出错信息为:
不能识别oleinitialize
不能识别oleuninitialize
解决方案 »
- delphi中三层结构怎样设计?一个管理软件的应用服务器端需要建多少个Remote Data Module?
- ACCESS数据库损坏问题(急!!!!!)
- 窗口间回传值的问题??(小女子急求助!!!)
- 最简单的问题,可是我不会,大家帮忙!
- 用socket api怎么实现局域网广播?
- 怎样用delphi语句直接创建的sqlserver数据库,也就是说,用户不用直接操作sqlserver??
- 请问各位listview的问题
- 兄弟的这段程序在编译时出现('[' expected but ':='found),请兄弟们指点
- 请问:我的语句错在那里?应如何改?
- 为什么我的软件发布状态总是“未发布”?
- 用TWebBrowser时如何禁止POP网页弹出?
- 这个有错误吗?为什么不能创建一个动态图标?
2.uses ActiveX
我用下句:webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext
去取得含框架网页的框架中的内容时,因为框架中显示的为含http://www.x.com的网页(如:http://www.PostalPennies.com/cgi-bin/[email protected])而被EoleException类拒绝访问,无法操作该框架,无法取得该框架的内容。OuterText与innertext的差别仅在于是否取出标志。