请帮帮忙看以下为什么会提示"指定的协议无效"?我是在winxp+d7上面做 ( 积分: 50 )

  • 主题发起人 主题发起人 xy_c
  • 开始时间 开始时间
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, '', '');"这句话错,是不是要在操作系统上再安装什么东西呢?


 

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, '', '');"这句话错,是不是要在操作系统上再安装什么东西呢?


 
是不是参数个数或者参数类型输入不对
 
参数不会错。
 
后退
顶部