0
点赞
收藏
分享

微信扫一扫

(MFC)子线程的数据如何传递给主线程中?

主线程的PreTranslateMessage可以接受子线程的PostThreadMessage

在主线程中重载PreTranslateMessage函数,用于接受子线程的消息:

BOOL CMFCApp::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == UM_PICKERELEMENT)
{
osg::Node *pNode = ((osg::Node *)pMsg->lParam);
CEntitySelectTrriger::Instance()->TrrigerEntitySelEvent(pNode);
}

return CBCGPWinApp::PreTranslateMessage(pMsg);
}

在子线程中,用PostThreadMessage向主线程中发送消息:

AfxGetApp()->PostThreadMessage(UM_PICKERELEMENT, 0, (LPARAM)anno);

 


举报

相关推荐

0 条评论