前几天还正常的代码,现在怎么不行了呢?出现断言错误:
File:occsite.cpp
Line:161
选择调试将出现未处理的异常。不过Release版还能正常部分代码如下:if (!CreateControl(CLSID_WebBrowser, NULL,
WS_VISIBLE | WS_CHILD, rcClient, pParent, AFX_IDW_PANE_FIRST)) {
TRACE0("Unable to create control");
return false;
}
LPUNKNOWN lpUnk = GetControlUnknown();
HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
if (FAILED(hr)) {
m_pBrowserApp = NULL;
TRACE0("Unable to create web browser");
return false;
}
File:occsite.cpp
Line:161
选择调试将出现未处理的异常。不过Release版还能正常部分代码如下:if (!CreateControl(CLSID_WebBrowser, NULL,
WS_VISIBLE | WS_CHILD, rcClient, pParent, AFX_IDW_PANE_FIRST)) {
TRACE0("Unable to create control");
return false;
}
LPUNKNOWN lpUnk = GetControlUnknown();
HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
if (FAILED(hr)) {
m_pBrowserApp = NULL;
TRACE0("Unable to create web browser");
return false;
}
解决方案 »
- CScrollBar控件在Unicode下效果问题
- MFC 程序只启动一次
- netbios获取网卡mac,结果返回NRC_OPENERR(0x3f)(如果能解决,加30分奖励)
- 工具栏 图标
- console Application 如何调用外部文件的数据(如:ini,txt)
- 请问:在写atl dll中,想传递一个HANDLE类型的数据,怎么进行处理?
- 怎么遍历查找自定义结构的stl中List的某一个值?
- 求教!如何得到CDialogBar上某个CButton控件在该DialogBar上的坐标值?
- 关于打印的问题!谢谢!
- CPtrList的问题! 这个类应该怎么用啊!
- vc中的 aa.h 和 aa.cpp 区别 联系?
- 鼠标悬停时,用黄色标签显示所指对象信息,如何实现的???
File:occsite.cpp
Line:161
看看是那个函数的参数有错误阿。另外,使用try ,catch
LPCTSTR lpszWindowName, DWORD dwStyle, const POINT* ppt, const SIZE* psize,
UINT nID, CFile* pPersist, BOOL bStorage, BSTR bstrLicKey)
{
HRESULT hr = E_FAIL;
m_hWnd = NULL;
CSize size; // Connect the OLE Control with its proxy CWnd object
if (pWndCtrl != NULL)
{
File:occsite.cpp Line:161: ASSERT(pWndCtrl->m_pCtrlSite == NULL);
m_pWndCtrl = pWndCtrl;
pWndCtrl->m_pCtrlSite = this;
}奇怪的是我的程序没有修改过,前几天还正常,现在报错;而且我的程序复制到别的机器上也正常,是不是系统环境差什么冬冬?
初始化OLE库是什么函数,AfxOleInit( )还是CoInitialize(NULL)或其它?AfxOleInit( )和CoInitialize(NULL)都没发现,不过有AFX_OLE_TRUE。
高手见笑,我是菜鸟,刚接手别人的代码,恳请指教。 补充说明,问题中创建浏览器控件的代码是在HHCTRL.CPP文件的以下函数中:
// Copyright (C) 1998-1999 KeyWorks Software. // This class is designed for embedding a window that displays HTML content. It
// is modeled after the CHtmlView class, but can be used as a control and has
// additional functionality for supporting HTML Help (.CHM and .ITS file
// support). See hhctrl.cpp for more information........
bool CHHCtrl::Create(CWnd* pParent, const RECT& rc, DWORD dwBtns, LPCTSTR pszHomeURL, bool fText)
{