OLECMDID_SAVEAS 使对话框不被弹出
来源:百度文库 编辑:神马文学网 时间:2024/05/01 00:53:43
前天偶然发现m_Web.ExecWB(OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER,&va_inVal,&va_outVal); 能够调出ie的对话框,而且还可以保存为*.mht格式,但试尽了参数,也没法使对话框不被弹出而保存该文件为*.mht,请问各位有什么高招?
A
IDM_SAVEAS Command ID
--------------------------------------------------------------------------------
Saves the current Web page to a file.
C++ Information
Command group CGID_MSHTML (defined in mshtmhst.h)
Symbolic constant IDM_SAVEAS
User interface Optional. This command displays a dialogue box if the nCmdExecOpt argument of IOleCommandTarget::Exec is set to MSOCMDEXECOPT_DODEFAULT, MSOCMDEXECOPT_PROMPTUSER, or NULL. It does not display a dialogue box if the argument is set to MSOCMDEXECOPT_DONTPROMPTUSER.
IOleCommandTarget::Exec parameters pvaIn VARIANT of type VT_BSTR that specifies the path and file name of the file to which to save the Web page. When the path contains more than one folder name, separate the folder names with two backward slashes (\\).
pvaOut Set to NULL.
Header file mshtmcid.h
Applies to IHTMLDocument2::execCommand, IHTMLDocument2::queryCommandEnabled, IHTMLDocument2::queryCommandIndeterm, IHTMLDocument2::queryCommandState, IHTMLDocument2::queryCommandSupported, IHTMLDocument2::queryCommandValue, emit_hlink;, IOleCommandTarget::QueryStatus .
保存到一个.mht文件,并且设置DONTPROMPTUSER看看
Accomplishing this task from a Visual C++ host is very straightforward. You can use an IWebBrowser2 interface to call the QueryInterface method for the IHTMLDocument2 interface. After you obtain a pointer to the document, then call QueryInterface for the IPersistFile interface. After you obtain this interface pointer, you can call the save method to save the file to disk.
HRESULT hr = E_FAIL;
IDispatch* pDisp = NULL;
IHTMLDocument2* pDoc = NULL;
pDisp = m_webOC.GetDocument();
if(SUCCEEDED(hr = pDisp->QueryInterface(IID_IHTMLDocument2,(void**)&pDoc)))
{
IPersistFile* pFile = NULL;
if(SUCCEEDED(pDoc->QueryInterface(IID_IPersistFile,(void**)&pFile)))
{
LPCOLESTR file = L"c:\\test1.mht";
pFile->Save(file,TRUE);
}
}
A
IDM_SAVEAS Command ID
--------------------------------------------------------------------------------
Saves the current Web page to a file.
C++ Information
Command group CGID_MSHTML (defined in mshtmhst.h)
Symbolic constant IDM_SAVEAS
User interface Optional. This command displays a dialogue box if the nCmdExecOpt argument of IOleCommandTarget::Exec is set to MSOCMDEXECOPT_DODEFAULT, MSOCMDEXECOPT_PROMPTUSER, or NULL. It does not display a dialogue box if the argument is set to MSOCMDEXECOPT_DONTPROMPTUSER.
IOleCommandTarget::Exec parameters pvaIn VARIANT of type VT_BSTR that specifies the path and file name of the file to which to save the Web page. When the path contains more than one folder name, separate the folder names with two backward slashes (\\).
pvaOut Set to NULL.
Header file mshtmcid.h
Applies to IHTMLDocument2::execCommand, IHTMLDocument2::queryCommandEnabled, IHTMLDocument2::queryCommandIndeterm, IHTMLDocument2::queryCommandState, IHTMLDocument2::queryCommandSupported, IHTMLDocument2::queryCommandValue, emit_hlink;, IOleCommandTarget::QueryStatus .
保存到一个.mht文件,并且设置DONTPROMPTUSER看看
Accomplishing this task from a Visual C++ host is very straightforward. You can use an IWebBrowser2 interface to call the QueryInterface method for the IHTMLDocument2 interface. After you obtain a pointer to the document, then call QueryInterface for the IPersistFile interface. After you obtain this interface pointer, you can call the save method to save the file to disk.
HRESULT hr = E_FAIL;
IDispatch* pDisp = NULL;
IHTMLDocument2* pDoc = NULL;
pDisp = m_webOC.GetDocument();
if(SUCCEEDED(hr = pDisp->QueryInterface(IID_IHTMLDocument2,(void**)&pDoc)))
{
IPersistFile* pFile = NULL;
if(SUCCEEDED(pDoc->QueryInterface(IID_IPersistFile,(void**)&pFile)))
{
LPCOLESTR file = L"c:\\test1.mht";
pFile->Save(file,TRUE);
}
}
OLECMDID_SAVEAS 使对话框不被弹出
父页面 弹出div对话框
InputBox弹出交互式输入对话框的实例
ASP.NET中使用AJAX时如何弹出对话框
ASP.NET中使用AJAX时如何弹出对话框
Confirm对话框在数据库操作前的弹出
对话框
弹出网页或不定时弹出网页的解决办法
自动弹出网页或不定时弹出网页的解决方法
如何在程序执行比较长时间的处理时弹出一个等待对话框 VC/MFC / 基础类
用独立线程解决弹出模态对话框后执行自定义函数问题 - VC/MFC - 提供最全面实用的J...
取消弹出窗口被拦截的方法
眼球弹出
VC:个性化对话框
VC:个性化对话框2
目录选择对话框
VB- 工具栏、对话框
对话框的设置
安全气囊未弹出致使司机身亡 北京奔驰被判赔偿
如何获取所有RedioButton并弹出当前被选中是RedioButton的值
自动弹出"记事本"窗口
javascript弹出窗口总结
禁止自动弹出网页
电脑自动弹出网页