谁能给我个用ole控制IE的例子 (195分)

  • 主题发起人 主题发起人 win000987
  • 开始时间 开始时间
使用OLE控制IE
unit ligwin1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

ExtCtrls, ComCtrls, StdCtrls,ComObj, Shellapi;



type

TForm1 = class(TForm)

Button1: TButton;

Button2: TButton;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

app:Variant;

public

{ Public declarations }

end;



var

Form1: TForm1;



implementation



{$R *.DFM}



procedure TForm1.Button1Click(Sender: TObject);

begin

try

app.Navigate('c:/chih_com/index.html');

app.Visible:=TRUE;

except

//on EOleSysError do MessageBox(0,'EOleSysError','提示信息',MB_OK);

app:=CreateOleObject('InternetExplorer.Application');

app.Navigate('c:/chih_com/index.html');

app.Visible:=TRUE;

end;

end;



procedure TForm1.FormCreate(Sender: TObject);

begin

app:=CreateOleObject('InternetExplorer.Application');

end;



procedure TForm1.Button2Click(Sender: TObject);

begin

try

app.Navigate('c:/chih_com/index.html',1);

app.Visible:=TRUE;

except

app:=CreateOleObject('InternetExplorer.Application');

app.Navigate('c:/chih_com/index.html');

app.Visible:=TRUE;

end;

end;



end.


 
谢谢,,实际上我提出问题后就已经得到答案了,,不过还是要谢谢你
 
后退
顶部