MFC在加载消息字符资源 GetMessageString 失败时会输出调试信息
解决方法:
- 为对应的ID添加对应资源(修改对应资源的信息非空)
- 重载函数修改 GetMessageString 其中包括两种方法都可以
void CMainFrame::GetMessageString(UINT nID, CString& rMessage) const
{
#if 0
LPTSTR lpsz = rMessage.GetBuffer(255);
if (AfxLoadString(nID, lpsz) != 0)
{
lpsz = _tcschr(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
rMessage.ReleaseBuffer();
#elif defined(_DEBUG)
UINT nLevel;
ATLTRACESTATUS eStatus;
ATL::CTrace::s_trace.GetCategory(traceAppMsg, &nLevel, &eStatus);
ATL::CTrace::s_trace.ChangeCategory(traceAppMsg, 0, ATLTRACESTATUS_DISABLED);
CFrameWndEx::GetMessageString(nID, rMessage);
ATL::CTrace::s_trace.ChangeCategory(traceAppMsg, nLevel, eStatus);
#else
CFrameWndEx::GetMessageString(nID, rMessage);
#endif
return;
}
标签:...,prompt,no,traceAppMsg,GetMessageString,nID,rMessage,lpsz,ATL
From: https://www.cnblogs.com/zzz3265/p/17031400.html