save url as a single file

来源(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();
}




Link: http://www.asm32.net/article_details.aspx?id=396


浏览次数 559 发布时间 2006-04-16 01:33:37 从属分类 VC++ 【评论】【 】【打印】【关闭
 
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1