X
xy_c
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,CDO_TLB, ADODB_TLB, OleCtrls, SHDocVw,stdctrls, OleServer,activex;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Message1: TMessage;
Configuration1: TConfiguration;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
var
Msg: IMessage;
Conf: IConfiguration;
Stream: _Stream;
URL : widestring;
begin
WebBrowser1.Navigate('news.sina.com.cn');
// if not Assigned(Webbrowser1.Document) then Exit;
URL := Webbrowser1.LocationURL;
Msg := CoMessage.Create;
Conf := CoConfiguration.Create;
try
Msg.Configuration := Conf;
Msg.CreateMHTMLBody(URL, 0, '', '');
Stream := Msg.GetStream;
Stream.SaveToFile('c:/test1.mht', adSaveCreateOverWrite);
finally
Msg := nil;
Conf := nil;
Stream := nil;
end;
end;
end.
我跟踪时提示在"Msg.CreateMHTMLBody(URL, 0, '', '');"这句话错,是不是要在操作系统上再安装什么东西呢?