扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:中国电子科技集团公司第二十二研 来源:天极网 2007年10月19日
关键字:
// 显示打开文件对话框 CFileDialog fileDlg(FALSE, "*.doc", "*.doc", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Word文件(*.doc)|*.doc||", NULL); if (fileDlg.DoModal() != IDOK) return; CString sPath = fileDlg.GetPathName(); char cPath[256]; memset(cPath, 0, sizeof(cPath)); memcpy(cPath, sPath, sPath.GetLength()); WCHAR wPath[256]; memset(wPath, 0, sizeof(wPath)); MultiByteToWideChar(CP_ACP, MB_COMPOSITE, cPath, sPath.GetLength(), wPath, sizeof(wPath)); IDispatch *pOle = m_pSelection->GetIDispatch(); if (!pOle ) return; // No ole document IPersistFile *pPFile = NULL; pOle->QueryInterface(IID_IPersistFile, (void**)&pPFile); if (!pPFile) { // 不支持IPersistFile接口 if (pOle) pOle->Release(); if (pPFile) pPFile->Release(); } else pPFile->Save(wPath, FALSE); |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。