怎样获得网页源代码?-----新手(100分)

  • 主题发起人 主题发起人 soai2000
  • 开始时间 开始时间
S

soai2000

Unregistered / Unconfirmed
GUEST, unregistred user!
一个webserverapplication,添加一个action动作,怎样获得response.content的网页代码(是Tstring类型),而后,再怎样把这段代码传给另一个网页(假设是1.html),处理后,用什么函数能直接跳转到这个网页1.html上(在浏览器上显示出来).
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw,MSHTML, StdCtrls;

type
TForm1 = class(TForm)
Memo1: TMemo;
WebBrowser1: TWebBrowser;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
ie:IWebBrowser2;
aa:olevariant;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
IDoc: IHTMLDocument2;


begin

ie:=CoInternetExplorer.Create;
ie.Stop ;
ie.Visible:=wordbool(true);
ie.Navigate('http://server/doctorschoolf/facility/index.aspx',aa,aa,aa,aa);
ie.Visible:=wordbool(true);

WebBrowser1.Navigate('http://server/doctorschoolf/facility/index.aspx');

// ie.Document.QueryInterface(IHTMLDocument2,IDoc);

end;

procedure TForm1.Button1Click(Sender: TObject);
var
IDoc: IHTMLDocument2;
begin
WebBrowser1.Document.QueryInterface(IHTMLDocument2,IDoc);
memo1.Text:=idoc.body.innerHTML;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ie.ExecWB(OLECMDID_PREREFRESH,aa,aa,aa);
end;

end.
 
接受答案了.
 
后退
顶部