UIBase.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. #include "StdAfx.h"
  2. #ifdef _DEBUG
  3. #include <shlwapi.h>
  4. #pragma comment(lib, "shlwapi.lib")
  5. #endif
  6. namespace DuiLib {
  7. /////////////////////////////////////////////////////////////////////////////////////
  8. //
  9. //
  10. void DUILIB_API DUI__Trace(LPCTSTR pstrFormat, ...)
  11. {
  12. #ifdef _DEBUG
  13. TCHAR szBuffer[300] = { 0 };
  14. va_list args;
  15. va_start(args, pstrFormat);
  16. ::wvnsprintf(szBuffer, lengthof(szBuffer) - 2, pstrFormat, args);
  17. _tcscat(szBuffer, _T("\n"));
  18. va_end(args);
  19. ::OutputDebugString(szBuffer);
  20. #endif
  21. }
  22. LPCTSTR DUI__TraceMsg(UINT uMsg)
  23. {
  24. #define MSGDEF(x) if(uMsg==x) return _T(#x)
  25. MSGDEF(WM_SETCURSOR);
  26. MSGDEF(WM_NCHITTEST);
  27. MSGDEF(WM_NCPAINT);
  28. MSGDEF(WM_PAINT);
  29. MSGDEF(WM_ERASEBKGND);
  30. MSGDEF(WM_NCMOUSEMOVE);
  31. MSGDEF(WM_MOUSEMOVE);
  32. MSGDEF(WM_MOUSELEAVE);
  33. MSGDEF(WM_MOUSEHOVER);
  34. MSGDEF(WM_NOTIFY);
  35. MSGDEF(WM_COMMAND);
  36. MSGDEF(WM_MEASUREITEM);
  37. MSGDEF(WM_DRAWITEM);
  38. MSGDEF(WM_LBUTTONDOWN);
  39. MSGDEF(WM_LBUTTONUP);
  40. MSGDEF(WM_LBUTTONDBLCLK);
  41. MSGDEF(WM_RBUTTONDOWN);
  42. MSGDEF(WM_RBUTTONUP);
  43. MSGDEF(WM_RBUTTONDBLCLK);
  44. MSGDEF(WM_SETFOCUS);
  45. MSGDEF(WM_KILLFOCUS);
  46. MSGDEF(WM_MOVE);
  47. MSGDEF(WM_SIZE);
  48. MSGDEF(WM_SIZING);
  49. MSGDEF(WM_MOVING);
  50. MSGDEF(WM_GETMINMAXINFO);
  51. MSGDEF(WM_CAPTURECHANGED);
  52. MSGDEF(WM_WINDOWPOSCHANGED);
  53. MSGDEF(WM_WINDOWPOSCHANGING);
  54. MSGDEF(WM_NCCALCSIZE);
  55. MSGDEF(WM_NCCREATE);
  56. MSGDEF(WM_NCDESTROY);
  57. MSGDEF(WM_TIMER);
  58. MSGDEF(WM_KEYDOWN);
  59. MSGDEF(WM_KEYUP);
  60. MSGDEF(WM_CHAR);
  61. MSGDEF(WM_SYSKEYDOWN);
  62. MSGDEF(WM_SYSKEYUP);
  63. MSGDEF(WM_SYSCOMMAND);
  64. MSGDEF(WM_SYSCHAR);
  65. MSGDEF(WM_VSCROLL);
  66. MSGDEF(WM_HSCROLL);
  67. MSGDEF(WM_CHAR);
  68. MSGDEF(WM_SHOWWINDOW);
  69. MSGDEF(WM_PARENTNOTIFY);
  70. MSGDEF(WM_CREATE);
  71. MSGDEF(WM_NCACTIVATE);
  72. MSGDEF(WM_ACTIVATE);
  73. MSGDEF(WM_ACTIVATEAPP);
  74. MSGDEF(WM_CLOSE);
  75. MSGDEF(WM_DESTROY);
  76. MSGDEF(WM_GETICON);
  77. MSGDEF(WM_GETTEXT);
  78. MSGDEF(WM_GETTEXTLENGTH);
  79. static TCHAR szMsg[10];
  80. ::wsprintf(szMsg, _T("0x%04X"), uMsg);
  81. return szMsg;
  82. }
  83. /////////////////////////////////////////////////////////////////////////////////////
  84. //
  85. //
  86. //////////////////////////////////////////////////////////////////////////
  87. //
  88. DUI_BASE_BEGIN_MESSAGE_MAP(CNotifyPump)
  89. DUI_END_MESSAGE_MAP()
  90. static const DUI_MSGMAP_ENTRY* DuiFindMessageEntry(const DUI_MSGMAP_ENTRY* lpEntry,TNotifyUI& msg )
  91. {
  92. CDuiString sMsgType = msg.sType;
  93. CDuiString sCtrlName = msg.pSender->GetName();
  94. const DUI_MSGMAP_ENTRY* pMsgTypeEntry = NULL;
  95. while (lpEntry->nSig != DuiSig_end)
  96. {
  97. if(lpEntry->sMsgType==sMsgType)
  98. {
  99. if(!lpEntry->sCtrlName.IsEmpty())
  100. {
  101. if(lpEntry->sCtrlName==sCtrlName)
  102. {
  103. return lpEntry;
  104. }
  105. }
  106. else
  107. {
  108. pMsgTypeEntry = lpEntry;
  109. }
  110. }
  111. lpEntry++;
  112. }
  113. return pMsgTypeEntry;
  114. }
  115. bool CNotifyPump::AddVirtualWnd(CDuiString strName,CNotifyPump* pObject)
  116. {
  117. if( m_VirtualWndMap.Find(strName) == NULL )
  118. {
  119. m_VirtualWndMap.Insert(strName.GetData(),(LPVOID)pObject);
  120. return true;
  121. }
  122. return false;
  123. }
  124. bool CNotifyPump::RemoveVirtualWnd(CDuiString strName)
  125. {
  126. if( m_VirtualWndMap.Find(strName) != NULL )
  127. {
  128. m_VirtualWndMap.Remove(strName);
  129. return true;
  130. }
  131. return false;
  132. }
  133. bool CNotifyPump::LoopDispatch(TNotifyUI& msg)
  134. {
  135. const DUI_MSGMAP_ENTRY* lpEntry = NULL;
  136. const DUI_MSGMAP* pMessageMap = NULL;
  137. #ifndef UILIB_STATIC
  138. for(pMessageMap = GetMessageMap(); pMessageMap!=NULL; pMessageMap = (*pMessageMap->pfnGetBaseMap)())
  139. #else
  140. for(pMessageMap = GetMessageMap(); pMessageMap!=NULL; pMessageMap = pMessageMap->pBaseMap)
  141. #endif
  142. {
  143. #ifndef UILIB_STATIC
  144. ASSERT(pMessageMap != (*pMessageMap->pfnGetBaseMap)());
  145. #else
  146. ASSERT(pMessageMap != pMessageMap->pBaseMap);
  147. #endif
  148. if ((lpEntry = DuiFindMessageEntry(pMessageMap->lpEntries,msg)) != NULL)
  149. {
  150. goto LDispatch;
  151. }
  152. }
  153. return false;
  154. LDispatch:
  155. union DuiMessageMapFunctions mmf;
  156. mmf.pfn = lpEntry->pfn;
  157. bool bRet = false;
  158. int nSig;
  159. nSig = lpEntry->nSig;
  160. switch (nSig)
  161. {
  162. default:
  163. ASSERT(FALSE);
  164. break;
  165. case DuiSig_lwl:
  166. (this->*mmf.pfn_Notify_lwl)(msg.wParam,msg.lParam);
  167. bRet = true;
  168. break;
  169. case DuiSig_vn:
  170. (this->*mmf.pfn_Notify_vn)(msg);
  171. bRet = true;
  172. break;
  173. }
  174. return bRet;
  175. }
  176. void CNotifyPump::NotifyPump(TNotifyUI& msg)
  177. {
  178. ///遍历虚拟窗口
  179. if( !msg.sVirtualWnd.IsEmpty() ){
  180. for( int i = 0; i< m_VirtualWndMap.GetSize(); i++ ) {
  181. if( LPCTSTR key = m_VirtualWndMap.GetAt(i) ) {
  182. if( _tcsicmp(key, msg.sVirtualWnd.GetData()) == 0 ){
  183. CNotifyPump* pObject = static_cast<CNotifyPump*>(m_VirtualWndMap.Find(key, false));
  184. if( pObject && pObject->LoopDispatch(msg) )
  185. return;
  186. }
  187. }
  188. }
  189. }
  190. ///
  191. //遍历主窗口
  192. LoopDispatch( msg );
  193. }
  194. //////////////////////////////////////////////////////////////////////////
  195. ///
  196. CWindowWnd::CWindowWnd() : m_hWnd(NULL), m_OldWndProc(::DefWindowProc), m_bSubclassed(false)
  197. {
  198. }
  199. HWND CWindowWnd::GetHWND() const
  200. {
  201. return m_hWnd;
  202. }
  203. UINT CWindowWnd::GetClassStyle() const
  204. {
  205. return 0;
  206. }
  207. LPCTSTR CWindowWnd::GetSuperClassName() const
  208. {
  209. return NULL;
  210. }
  211. CWindowWnd::operator HWND() const
  212. {
  213. return m_hWnd;
  214. }
  215. HWND CWindowWnd::CreateDuiWindow( HWND hwndParent, LPCTSTR pstrWindowName,DWORD dwStyle /*=0*/, DWORD dwExStyle /*=0*/ )
  216. {
  217. return Create(hwndParent,pstrWindowName,dwStyle,dwExStyle,0,0,0,0,NULL);
  218. }
  219. HWND CWindowWnd::Create(HWND hwndParent, LPCTSTR pstrName, DWORD dwStyle, DWORD dwExStyle, const RECT rc, HMENU hMenu)
  220. {
  221. return Create(hwndParent, pstrName, dwStyle, dwExStyle, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, hMenu);
  222. }
  223. HWND CWindowWnd::Create(HWND hwndParent, LPCTSTR pstrName, DWORD dwStyle, DWORD dwExStyle, int x, int y, int cx, int cy, HMENU hMenu)
  224. {
  225. if( GetSuperClassName() != NULL && !RegisterSuperclass() ) return NULL;
  226. if( GetSuperClassName() == NULL && !RegisterWindowClass() ) return NULL;
  227. m_hWnd = ::CreateWindowEx(dwExStyle, GetWindowClassName(), pstrName, dwStyle, x, y, cx, cy, hwndParent, hMenu, CPaintManagerUI::GetInstance(), this);
  228. ASSERT(m_hWnd!=NULL);
  229. return m_hWnd;
  230. }
  231. HWND CWindowWnd::Subclass(HWND hWnd)
  232. {
  233. ASSERT(::IsWindow(hWnd));
  234. ASSERT(m_hWnd==NULL);
  235. m_OldWndProc = SubclassWindow(hWnd, __WndProc);
  236. if( m_OldWndProc == NULL ) return NULL;
  237. m_bSubclassed = true;
  238. m_hWnd = hWnd;
  239. ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LPARAM>(this));
  240. return m_hWnd;
  241. }
  242. void CWindowWnd::Unsubclass()
  243. {
  244. ASSERT(::IsWindow(m_hWnd));
  245. if( !::IsWindow(m_hWnd) ) return;
  246. if( !m_bSubclassed ) return;
  247. SubclassWindow(m_hWnd, m_OldWndProc);
  248. m_OldWndProc = ::DefWindowProc;
  249. m_bSubclassed = false;
  250. }
  251. void CWindowWnd::ShowWindow(bool bShow /*= true*/, bool bTakeFocus /*= false*/)
  252. {
  253. ASSERT(::IsWindow(m_hWnd));
  254. if( !::IsWindow(m_hWnd) ) return;
  255. ::ShowWindow(m_hWnd, bShow ? (bTakeFocus ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE) : SW_HIDE);
  256. }
  257. UINT CWindowWnd::ShowModal()
  258. {
  259. ASSERT(::IsWindow(m_hWnd));
  260. UINT nRet = 0;
  261. HWND hWndParent = GetWindowOwner(m_hWnd);
  262. ::ShowWindow(m_hWnd, SW_SHOWNORMAL);
  263. ::EnableWindow(hWndParent, FALSE);
  264. MSG msg = { 0 };
  265. while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) {
  266. if( msg.message == WM_CLOSE && msg.hwnd == m_hWnd ) {
  267. nRet = msg.wParam;
  268. ::EnableWindow(hWndParent, TRUE);
  269. ::SetFocus(hWndParent);
  270. }
  271. if( !CPaintManagerUI::TranslateMessage(&msg) ) {
  272. ::TranslateMessage(&msg);
  273. ::DispatchMessage(&msg);
  274. }
  275. if( msg.message == WM_QUIT ) break;
  276. }
  277. ::EnableWindow(hWndParent, TRUE);
  278. ::SetFocus(hWndParent);
  279. if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam);
  280. return nRet;
  281. }
  282. void CWindowWnd::Close(UINT nRet)
  283. {
  284. ASSERT(::IsWindow(m_hWnd));
  285. if( !::IsWindow(m_hWnd) ) return;
  286. PostMessage(WM_CLOSE, (WPARAM)nRet, 0L);
  287. }
  288. void CWindowWnd::CenterWindow()
  289. {
  290. ASSERT(::IsWindow(m_hWnd));
  291. ASSERT((GetWindowStyle(m_hWnd)&WS_CHILD)==0);
  292. RECT rcDlg = { 0 };
  293. ::GetWindowRect(m_hWnd, &rcDlg);
  294. RECT rcArea = { 0 };
  295. RECT rcCenter = { 0 };
  296. HWND hWnd=*this;
  297. HWND hWndParent = ::GetParent(m_hWnd);
  298. HWND hWndCenter = ::GetWindowOwner(m_hWnd);
  299. if (hWndCenter!=NULL)
  300. hWnd=hWndCenter;
  301. // 处理多显示器模式下屏幕居中
  302. MONITORINFO oMonitor = {};
  303. oMonitor.cbSize = sizeof(oMonitor);
  304. ::GetMonitorInfo(::MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST), &oMonitor);
  305. rcArea = oMonitor.rcWork;
  306. if( hWndCenter == NULL || IsIconic(hWndCenter))
  307. rcCenter = rcArea;
  308. else
  309. ::GetWindowRect(hWndCenter, &rcCenter);
  310. int DlgWidth = rcDlg.right - rcDlg.left;
  311. int DlgHeight = rcDlg.bottom - rcDlg.top;
  312. // Find dialog's upper left based on rcCenter
  313. int xLeft = (rcCenter.left + rcCenter.right) / 2 - DlgWidth / 2;
  314. int yTop = (rcCenter.top + rcCenter.bottom) / 2 - DlgHeight / 2;
  315. // The dialog is outside the screen, move it inside
  316. if( xLeft < rcArea.left ) xLeft = rcArea.left;
  317. else if( xLeft + DlgWidth > rcArea.right ) xLeft = rcArea.right - DlgWidth;
  318. if( yTop < rcArea.top ) yTop = rcArea.top;
  319. else if( yTop + DlgHeight > rcArea.bottom ) yTop = rcArea.bottom - DlgHeight;
  320. ::SetWindowPos(m_hWnd, NULL, xLeft, yTop, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
  321. }
  322. void CWindowWnd::SetIcon(UINT nRes)
  323. {
  324. // UMU: 防止某些 DPI 设置下图标模糊
  325. //HICON hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
  326. HICON hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON, (::GetSystemMetrics(SM_CXICON) + 15) & ~15, (::GetSystemMetrics(SM_CYICON)+ 15) & ~15, LR_DEFAULTCOLOR);
  327. ASSERT(hIcon);
  328. ::SendMessage(m_hWnd, WM_SETICON, (WPARAM) TRUE, (LPARAM) hIcon);
  329. // UMU: 防止某些 DPI 设置下图标模糊
  330. //hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
  331. hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON, (::GetSystemMetrics(SM_CXSMICON) + 15) & ~15, (::GetSystemMetrics(SM_CYSMICON) + 15) & ~15, LR_DEFAULTCOLOR);
  332. ASSERT(hIcon);
  333. ::SendMessage(m_hWnd, WM_SETICON, (WPARAM) FALSE, (LPARAM) hIcon);
  334. }
  335. bool CWindowWnd::RegisterWindowClass()
  336. {
  337. WNDCLASS wc = { 0 };
  338. wc.style = GetClassStyle();
  339. wc.cbClsExtra = 0;
  340. wc.cbWndExtra = 0;
  341. wc.hIcon = NULL;
  342. wc.lpfnWndProc = CWindowWnd::__WndProc;
  343. wc.hInstance = CPaintManagerUI::GetInstance();
  344. wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
  345. wc.hbrBackground = NULL;
  346. wc.lpszMenuName = NULL;
  347. wc.lpszClassName = GetWindowClassName();
  348. ATOM ret = ::RegisterClass(&wc);
  349. ASSERT(ret!=NULL || ::GetLastError()==ERROR_CLASS_ALREADY_EXISTS);
  350. return ret != NULL || ::GetLastError() == ERROR_CLASS_ALREADY_EXISTS;
  351. }
  352. bool CWindowWnd::RegisterSuperclass()
  353. {
  354. // Get the class information from an existing
  355. // window so we can subclass it later on...
  356. WNDCLASSEX wc = { 0 };
  357. wc.cbSize = sizeof(WNDCLASSEX);
  358. if( !::GetClassInfoEx(NULL, GetSuperClassName(), &wc) ) {
  359. if( !::GetClassInfoEx(CPaintManagerUI::GetInstance(), GetSuperClassName(), &wc) ) {
  360. ASSERT(!"Unable to locate window class");
  361. return NULL;
  362. }
  363. }
  364. m_OldWndProc = wc.lpfnWndProc;
  365. wc.lpfnWndProc = CWindowWnd::__ControlProc;
  366. wc.hInstance = CPaintManagerUI::GetInstance();
  367. wc.lpszClassName = GetWindowClassName();
  368. ATOM ret = ::RegisterClassEx(&wc);
  369. ASSERT(ret!=NULL || ::GetLastError()==ERROR_CLASS_ALREADY_EXISTS);
  370. return ret != NULL || ::GetLastError() == ERROR_CLASS_ALREADY_EXISTS;
  371. }
  372. LRESULT CALLBACK CWindowWnd::__WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  373. {
  374. CWindowWnd* pThis = NULL;
  375. if( uMsg == WM_NCCREATE ) {
  376. LPCREATESTRUCT lpcs = reinterpret_cast<LPCREATESTRUCT>(lParam);
  377. pThis = static_cast<CWindowWnd*>(lpcs->lpCreateParams);
  378. pThis->m_hWnd = hWnd;
  379. ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LPARAM>(pThis));
  380. }
  381. else {
  382. pThis = reinterpret_cast<CWindowWnd*>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
  383. if( uMsg == WM_NCDESTROY && pThis != NULL ) {
  384. LRESULT lRes = ::CallWindowProc(pThis->m_OldWndProc, hWnd, uMsg, wParam, lParam);
  385. ::SetWindowLongPtr(pThis->m_hWnd, GWLP_USERDATA, 0L);
  386. if( pThis->m_bSubclassed ) pThis->Unsubclass();
  387. pThis->m_hWnd = NULL;
  388. pThis->OnFinalMessage(hWnd);
  389. return lRes;
  390. }
  391. }
  392. if( pThis != NULL ) {
  393. return pThis->HandleMessage(uMsg, wParam, lParam);
  394. }
  395. else {
  396. return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
  397. }
  398. }
  399. LRESULT CALLBACK CWindowWnd::__ControlProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  400. {
  401. CWindowWnd* pThis = NULL;
  402. if( uMsg == WM_NCCREATE ) {
  403. LPCREATESTRUCT lpcs = reinterpret_cast<LPCREATESTRUCT>(lParam);
  404. pThis = static_cast<CWindowWnd*>(lpcs->lpCreateParams);
  405. ::SetProp(hWnd, _T("WndX"), (HANDLE) pThis);
  406. pThis->m_hWnd = hWnd;
  407. }
  408. else {
  409. pThis = reinterpret_cast<CWindowWnd*>(::GetProp(hWnd, _T("WndX")));
  410. if( uMsg == WM_NCDESTROY && pThis != NULL ) {
  411. LRESULT lRes = ::CallWindowProc(pThis->m_OldWndProc, hWnd, uMsg, wParam, lParam);
  412. if( pThis->m_bSubclassed ) pThis->Unsubclass();
  413. ::SetProp(hWnd, _T("WndX"), NULL);
  414. pThis->m_hWnd = NULL;
  415. pThis->OnFinalMessage(hWnd);
  416. return lRes;
  417. }
  418. }
  419. if( pThis != NULL ) {
  420. return pThis->HandleMessage(uMsg, wParam, lParam);
  421. }
  422. else {
  423. return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
  424. }
  425. }
  426. LRESULT CWindowWnd::SendMessage(UINT uMsg, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
  427. {
  428. ASSERT(::IsWindow(m_hWnd));
  429. return ::SendMessage(m_hWnd, uMsg, wParam, lParam);
  430. }
  431. LRESULT CWindowWnd::PostMessage(UINT uMsg, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
  432. {
  433. ASSERT(::IsWindow(m_hWnd));
  434. return ::PostMessage(m_hWnd, uMsg, wParam, lParam);
  435. }
  436. void CWindowWnd::ResizeClient(int cx /*= -1*/, int cy /*= -1*/)
  437. {
  438. ASSERT(::IsWindow(m_hWnd));
  439. RECT rc = { 0 };
  440. if( !::GetClientRect(m_hWnd, &rc) ) return;
  441. if( cx != -1 ) rc.right = cx;
  442. if( cy != -1 ) rc.bottom = cy;
  443. if( !::AdjustWindowRectEx(&rc, GetWindowStyle(m_hWnd), (!(GetWindowStyle(m_hWnd) & WS_CHILD) && (::GetMenu(m_hWnd) != NULL)), GetWindowExStyle(m_hWnd)) ) return;
  444. ::SetWindowPos(m_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
  445. }
  446. LRESULT CWindowWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
  447. {
  448. return ::CallWindowProc(m_OldWndProc, m_hWnd, uMsg, wParam, lParam);
  449. }
  450. void CWindowWnd::OnFinalMessage(HWND /*hWnd*/)
  451. {
  452. }
  453. } // namespace DuiLib