WTL 拆分器示例中的调试断言
Debug assertion in WTL splitter sample
在使用 vs2013
编译的 WTL sample 中从主机菜单中单击读取或清除剪贴板时
CHAIN_COMMANDS_MEMBER(m_wndFormatList)从主机传消息到成员列表控件但是消息为空?
堆栈跟踪:
WTLClipSpy.exe!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> ::SetMsgHandled(int bHandled) Line 3213 C++
WTLClipSpy.exe!CClipSpyListCtrl::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 30 C++
WTLClipSpy.exe!CMainFrame::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 41 C++
调试输出:
调试断言失败!
程序:...nloads\source\WTL4MFC7_demo\WTLClipSpy.\Debug\WTLClipSpy.exe
文件:c:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\atlwin.h
线路:3213
表达式:pMsg != 0
这可能是一个不太流行的 CHAIN_COMMANDS_MEMBER
宏的回归问题。
解决方法可能如下所示:
//CHAIN_COMMANDS_MEMBER(m_wndFormatList)
if(uMsg == WM_COMMAND)
{
lResult = m_wndFormatList.SendMessage(uMsg, wParam, lParam);
if(lResult == 0)
return TRUE;
}
或者,如果您更愿意绕过 SendMessage
API(有意义),那么您将需要处理链式控件中的 m_pCurrentMsg
初始化。更好但更长的修复。
在使用 vs2013
编译的 WTL sample 中从主机菜单中单击读取或清除剪贴板时CHAIN_COMMANDS_MEMBER(m_wndFormatList)从主机传消息到成员列表控件但是消息为空?
堆栈跟踪:
WTLClipSpy.exe!ATL::CWindowImplRoot<WTL::CListViewCtrlT<ATL::CWindow> ::SetMsgHandled(int bHandled) Line 3213 C++
WTLClipSpy.exe!CClipSpyListCtrl::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 30 C++
WTLClipSpy.exe!CMainFrame::ProcessWindowMessage(HWND__ * hWnd, unsigned int uMsg, unsigned int wParam, long lParam, long & lResult, unsigned long dwMsgMapID) Line 41 C++
调试输出:
调试断言失败!
程序:...nloads\source\WTL4MFC7_demo\WTLClipSpy.\Debug\WTLClipSpy.exe 文件:c:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\atlwin.h 线路:3213
表达式:pMsg != 0
这可能是一个不太流行的 CHAIN_COMMANDS_MEMBER
宏的回归问题。
解决方法可能如下所示:
//CHAIN_COMMANDS_MEMBER(m_wndFormatList)
if(uMsg == WM_COMMAND)
{
lResult = m_wndFormatList.SendMessage(uMsg, wParam, lParam);
if(lResult == 0)
return TRUE;
}
或者,如果您更愿意绕过 SendMessage
API(有意义),那么您将需要处理链式控件中的 m_pCurrentMsg
初始化。更好但更长的修复。