您的位置:首页 > 产品设计 > UI/UE

DUILib学习笔记---消息处理

2016-12-11 16:11 330 查看
WIN32下窗口消息循环

MSG msg = { 0 };
while( ::GetMessage(&msg, NULL, 0, 0) )
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}


1.消息循环,在CPaintManagerUI::MessageLoop()

--------duilib中增加了一个消息预处理,类似MFC::PreTranslateMessage()

MSG msg = { 0 };
while( ::GetMessage(&msg, NULL, 0, 0) )
{
if( !CPaintManagerUI::PreTranslateMessage(&msg) )//自己更改,原源码为TranslateMessage(&msg)
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}

如下图:



2.CPaintManagerUI::PreTranslateMessage(&msg)处理做了什么事情

---2.1判断是否具有WS_CHILD属性

---2.2具有WS_CHILD风格属性时,先判断m_aPreMessages有无数据
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: