soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SHostMgr.cpp
1#include <include/souistd.h>
2#include <helper/SHostMgr.h>
3
4SNSBEGIN
8
10{
11}
12
14{
15 SAutoLock autoLock(m_cs);
16 if (m_mapHostMsgHandler.Lookup(hHost))
17 return false;
18 m_mapHostMsgHandler[hHost] = true;
19 return true;
20}
21
23{
24 SAutoLock autoLock(m_cs);
25 return m_mapHostMsgHandler.RemoveKey(hHost);
26}
27
28void SHostMgr::DispatchMessage(UINT uMsg, WPARAM wp, LPARAM lp)
29{
30 SAutoLock autoLock(m_cs);
31 SPOSITION pos = m_mapHostMsgHandler.GetStartPosition();
32 while (pos)
33 { // can't call SHostWnd.Fun for multiple ui threads.
34 HWND hHost = m_mapHostMsgHandler.GetNextKey(pos);
35 ::PostMessage(hHost, uMsg, wp, lp);
36 }
37}
38
39SNSEND
Auto-lock class for managing critical sections.
bool RemoveHostMsgHandler(HWND hHost)
移除宿主窗口消息处理程序
Definition SHostMgr.cpp:22
~SHostMgr(void)
析构函数
Definition SHostMgr.cpp:9
bool AddHostMsgHandler(HWND hHost)
添加宿主窗口消息处理程序
Definition SHostMgr.cpp:13
void DispatchMessage(UINT uMsg, WPARAM wp=0, LPARAM lp=0)
分发消息到宿主窗口
Definition SHostMgr.cpp:28
SCriticalSection m_cs
临界区对象,用于线程同步
Definition SHostMgr.h:52
SHostMgr(void)
构造函数
Definition SHostMgr.cpp:5
SMap< HWND, bool > m_mapHostMsgHandler
宿主窗口消息处理程序映射表
Definition SHostMgr.h:51