叶
叶林
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码我在Delphi6 和 Windows2000 环境下调试通过。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,mshtml,SHdocvw, OleCtrls, SHDocVw_TLB;
type
TForm1 = class(TForm)
Button1: TButton;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
VAR
name,feature,replacelevariant;
tempdoc:IHTMLdocument2;
Begin
name:='';
feature:='';
replace:=true;
tempdoc:= WebBrowser1.Document as IHTMLdocument2 ;
tempdoc.open('http://www.htxx.com.cn',name,feature,replace);
End;
procedure TForm1.FormCreate(Sender: TObject);
begin
webbrowser1.Navigate('http://www.greatall.com');
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,mshtml,SHdocvw, OleCtrls, SHDocVw_TLB;
type
TForm1 = class(TForm)
Button1: TButton;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
VAR
name,feature,replacelevariant;
tempdoc:IHTMLdocument2;
Begin
name:='';
feature:='';
replace:=true;
tempdoc:= WebBrowser1.Document as IHTMLdocument2 ;
tempdoc.open('http://www.htxx.com.cn',name,feature,replace);
End;
procedure TForm1.FormCreate(Sender: TObject);
begin
webbrowser1.Navigate('http://www.greatall.com');
end;
end.