如果使用debug版本的activex,在ie关闭的时候出现Debug Assertion Failed!引起错误的代码在wincore.cpp中,如下://///////////////////////////////////////////////////////////////////////////
// The WndProc for all CWnd's and derived classesLRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
// special message which identifies the window as using AfxWndProc
if (nMsg == WM_QUERYAFXWNDPROC)
return 1;// all other messages route through message map
CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
ASSERT(pWnd != NULL);《《《《《《《《《《《《《《《《《《引发错误的行
ASSERT(pWnd->m_hWnd == hWnd);
if (pWnd == NULL || pWnd->m_hWnd != hWnd)
return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}
// The WndProc for all CWnd's and derived classesLRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
// special message which identifies the window as using AfxWndProc
if (nMsg == WM_QUERYAFXWNDPROC)
return 1;// all other messages route through message map
CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
ASSERT(pWnd != NULL);《《《《《《《《《《《《《《《《《《引发错误的行
ASSERT(pWnd->m_hWnd == hWnd);
if (pWnd == NULL || pWnd->m_hWnd != hWnd)
return ::DefWindowProc(hWnd, nMsg, wParam, lParam);
return AfxCallWndProc(pWnd, hWnd, nMsg, wParam, lParam);
}
出错断点在AfxWndPro里面
肯定是那个句柄检查有问题.
你调试一下,再具体分析问题点.
按情况设置断点,按F5,然后按F10一步步调试.
ieplore.exe
wincore.cpp
line:384
cause a assertion
ASSERT(pWnd != NULL); //查源码,这句断言出错,说明pWnd为NULL了.
在MSDN上查找函数:CWnd::FromHandlePermanent()
"Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, NULL is returned."
再自己进一步检查确认吧.
不会阿。
我最近一直在搞控件这个切换的问题。
切换后,控件是会析构。
如果切换不通知控件析构的话,我切换多个包含不同控件的页面,最后关闭的时候,前面的控件不就无法释放了。