这是读源码!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, OleCtrls, SHDocVw,mshtml;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
webbrowser1.Navigate('http://202.114.98.12/book/');
end;
procedure TForm1.Button2Click(Sender: TObject);
var
all:IHTMLElementcollection;
doc:IHTMLDocument2;
item:OleVariant;
begin
doc:=webbrowser1.document as ihtmldocument2;
all:=doc.all;
item:=all.item(0,varEmpty);
Memo1.Clear;
memo1.Lines.Add(item.innerhtml);//item.innerhtml就是源文件内容
end;
end.