#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile") #import <cdosys.dll> no_namespace rename("EOF", "EndOfFile") ............ void CSavemhtDlg::OnOK() { // save url as a single file, in fact I don't know if it is mht file, but it can be opened by IE, can someone tell me? CoInitialize(NULL); { IMessagePtr iMsg(__uuidof(Message)); IConfigurationPtr iConf(__uuidof(Configuration)); iMsg->Configuration = iConf; try { iMsg->CreateMHTMLBody( "http://example.microsoft.com", cdoSuppressNone, "domain\\username", "password"); } catch(_com_error err) { // handle exception } _StreamPtr pStream=iMsg->GetStream(); pStream->SaveToFile("test.mht",adSaveCreateOverWrite); } CoUninitialize(); }
在一定程度上是为多线程传输服务的
假设你能将一个大的网页整合成一个文件
速度有多慢可想而知现在的浏览器,都是多线程下载网页中的超链接
#import <cdosys.dll> no_namespace rename("EOF", "EndOfFile")
............
void CSavemhtDlg::OnOK()
{
// save url as a single file, in fact I don't know if it is mht file, but it can be opened by IE, can someone tell me?
CoInitialize(NULL);
{
IMessagePtr iMsg(__uuidof(Message));
IConfigurationPtr iConf(__uuidof(Configuration));
iMsg->Configuration = iConf;
try
{
iMsg->CreateMHTMLBody(
"http://example.microsoft.com",
cdoSuppressNone,
"domain\\username",
"password");
}
catch(_com_error err)
{
// handle exception
}
_StreamPtr pStream=iMsg->GetStream();
pStream->SaveToFile("test.mht",adSaveCreateOverWrite);
}
CoUninitialize();
}