首页 > 其他分享 >warning: no message line prompt for ...

warning: no message line prompt for ...

时间:2023-01-06 19:24:42浏览次数:52  
标签:... prompt no traceAppMsg GetMessageString nID rMessage lpsz ATL

MFC在加载消息字符资源 GetMessageString 失败时会输出调试信息
解决方法:

  1. 为对应的ID添加对应资源(修改对应资源的信息非空)
  2. 重载函数修改 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

相关文章