利用IE浏览本地HTML,WORD, pdf格式文件
2010-05-13 13:51
295 查看
1. bstrCurPath为文件的目录, bstrFileName为文件名;代码如下:
//利用IE控件,浏览WORD,pdf等文件。 void putLocalUrl(CComBSTR bstrCurPath, CComBSTR bstrFileName) { //获取IE控件指针 HWND hWnd = GetDlgItem(IDC_EXPLORER); CComPtr<IUnknown> spUnk; HRESULT hr = AtlAxGetControl(hWnd,&spUnk); if (SUCCEEDED(hr)) { hr = spUnk ->QueryInterface(IID_IWebBrowser2, (void **)&m_spWebBrowser2 ); //GetDlgControl(IDC_EXPLORER,IID_IWebBrowser2,(void **)&m_spWebBrowser2); if (SUCCEEDED(hr)) { CComBSTR bstrURL(bstrCurPath); bstrURL += bstrFileName; PTCHAR lpPath = _com_util::ConvertBSTRToString(bstrURL); if (_taccess(lpPath,0) == 0) { hr = m_spWebBrowser2->put_Visible(TRUE); VARIANT vInfo; vInfo.vt=VT_EMPTY; hr = m_spWebBrowser2 ->Navigate( bstrURL, &vInfo, &vInfo, &vInfo, &vInfo ); } else { MessageBox("无法加载!找不到路径!","IEContainer",MB_OK); } } } }
相关文章推荐
- java实现爬虫技术,读取txt,word,excel,ppt,pdf,html等格式的文件
- 网站开发之ie下在线浏览pdf文件无需本地支持
- 利用jacob将excel另存为html格式文件,利用jacob将word另存为html格式文件
- iOS利用QLPreviewController显示PDF,word,execl,txt等格式的文件
- 利用jacob将word另存为html格式文件及中文方块解决
- Flex air调用本地文件,比如Excel,Word,PDF,Notepad,html 文件 NativeProcess
- java实现爬虫技术,读取txt,word,excel,ppt,pdf,html等格式的文件
- asp.net导出excel-一行代码实现excel、xml、pdf、word、html、csv等7种格式文件导出功能而且美观-SNF快速开发平台
- 【iOS_GitHub】文档/文件查看器(支持本地或者其他app分享过来的word、excel、pdf、rtf等格式文件)
- Flex air 调用本地文件,比如Excel,Word,PDF,Notepad,html 文件
- 利用jodconverter(基于OpenOffice服务)将word文件(*.doc)转化为html格式
- Android遍历获取Office格式(Word,Excel,PPT,PDF)的文件并打开
- Word怎么转换成PDF格式的文件
- android用于打开各种文件的intent,包括以下文件PDF,PPT,WORD,EXCEL,CHM,HTML,TEXT,AUDIO,VIDEO
- lecene.net实现pdf,doc,xls,ppt,htm,html等格式文件的检索
- android打开pdf ppt word excel chm html text 文件的intent
- 打开pdf ppt word excel chm html text 文件的intent
- pdf文件转换成html格式的实用方法
- 在winform中利用外部程序打开pdf或者word等文件的方法
- 怎么将PDF文件转换成HTML格式