来源(null)
save url as a single file回复人: masterz(MS MVP) ( ) 信誉:147 2002-6-7 17:42:45 得分:300
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile") #import 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(); } |