LRESULT UIManager::ProcessMessage(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { switch(iMessage) { case WM_CREATE: if(!LyricManagerInstance) LyricManagerInstance = new LyricManager(); LyricManagerInstance->AddRedrawHandler(boost::bind(&UIManager::Invalidated, this, hWnd)); Invalidated(hWnd); break; case WM_CONTEXTMENU: case WM_NCRBUTTONUP: on_contextmenu(hWnd); break; case WM_KEYDOWN: case WM_SYSKEYDOWN: on_keydown(wParam); return 0; case WM_DESTROY: return 0; case WM_PAINT: PAINTSTRUCT ps; if(BeginPaint(hWnd, &ps) != NULL) { Draw(hWnd, ps.hdc); EndPaint(hWnd, &ps); } return 0; case WM_ERASEBKGND: return TRUE;/* case WM_USER + 1: { HDC hdc = GetDCEx(hWnd, NULL, DCX_WINDOW); Draw(hWnd, hdc); ReleaseDC(hWnd, hdc); return TRUE; }*/ } return DefWindowProc(hWnd, iMessage, wParam, lParam); }
LRESULT CComWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled) { switch(uMsg) { case WM_INITDIALOG: return on_create(m_hWnd, GetModuleHandle(0)); case WM_VSCROLL: case WM_HSCROLL: return on_scroll(uMsg, wParam, lParam); case WM_SIZE: __super::HandleMessage(uMsg, wParam, lParam, bHandled); return on_size(LOWORD(lParam), HIWORD(lParam)); case WM_CLOSE: return on_close(); case WM_COMMAND: return on_command(HWND(lParam), LOWORD(wParam), HIWORD(wParam)); case WM_DEVICECHANGE: return on_device_change(wParam, (DEV_BROADCAST_HDR*)lParam); case WM_SETTINGCHANGE: return on_setting_change(wParam, LPCTSTR(lParam)); case WM_CONTEXTMENU: return on_contextmenu(HWND(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_LBUTTONDOWN: return SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0); } if (uMsg >= WM_APP && uMsg <= 0xBFFF) return on_app(uMsg, wParam, lParam); return __super::HandleMessage(uMsg, wParam, lParam, bHandled); }