G
gdljf
Unregistered / Unconfirmed
GUEST, unregistred user!
[!]
我用下句:webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext
去取得含框架网页的框架中的内容时,因为框架中显示的为.cgi等含post数据的网页(如:http://www.PostalPennies.com/cgi-bin/signup.cgi?r=b.tenhave@chello.nl)而被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/signup.cgi?r=b.tenhave@chello.nl" 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&user_id=asdf@133165.com" 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
我用下句:webbrowser1.oleobject.document.documentelement.document.frames.item(i).document.documentelement.innertext
去取得含框架网页的框架中的内容时,因为框架中显示的为.cgi等含post数据的网页(如:http://www.PostalPennies.com/cgi-bin/signup.cgi?r=b.tenhave@chello.nl)而被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/signup.cgi?r=b.tenhave@chello.nl" 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&user_id=asdf@133165.com" 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