LRESULT DesktopUI::HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam) { LRESULT lRes=0; BOOL bHandled=TRUE; switch(uMsg) { case WM_CREATE: lRes=OnCreate(uMsg,wParam,lParam,bHandled);break; //能去除边框 case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);break; //去除显示的标题栏 case WM_SIZE: lRes=OnSize(uMsg,wParam,lParam,bHandled);break; //解决按住左键或右键时会出现边框的问题 case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; //实现按住窗口(除按钮外)拖动窗口 case WM_NCHITTEST: lRes=OnNcHitTest(uMsg,wParam,lParam,bHandled);break; //获取边框最大最小值 case WM_GETMINMAXINFO: lRes=OnGetMinMaxInfo(uMsg,wParam,lParam,bHandled);break; case WM_DESTROY: ::PostQuitMessage(0);break; case WM_HIVE_CELL: lRes = loop(uMsg,wParam,lParam);break; default: bHandled=FALSE; } if(bHandled) return lRes; if(m_pm.MessageHandler(uMsg,wParam,lParam,lRes)) return lRes; return CWindowWnd::HandleMessage(uMsg,wParam,lParam); }
//消息循环 LRESULT CMainDlg::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch( uMsg ) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_COPYDATA: lRes = OnCopyData(uMsg, wParam, lParam, bHandled); break; case WM_USER_PROG: lRes = OnUserProg(uMsg, wParam, lParam, bHandled); break; case WM_USER_TEXTPRINT:lRes = OnUserPrint(uMsg, wParam, lParam, bHandled); break; case WM_USER_DELETE_ITEM: lRes = OnUserCloseListItem(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; } if( bHandled ) return lRes; if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(WIN32) && !defined(UNDER_CE) case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break; #endif case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break; case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEMOVE: lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled); if (bHandled) return lRes; if (paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
BOOL CInputBox::ProcSubHandler(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { case WM_INITDIALOG: if (m_hWnd == NULL) m_hWnd = hDlg; return OnInitDialog(); case WM_SIZE: OnSize((UINT)wParam, LOWORD(lParam), HIWORD(lParam)); return TRUE; case WM_GETMINMAXINFO: OnGetMinMaxInfo((LPMINMAXINFO) lParam); return TRUE; case WM_TIMER: OnTimer((UINT)wParam); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: OnOK(); return TRUE; case IDCANCEL: OnCancel(); return TRUE; default: return FALSE; } default: return FALSE; } }
LRESULT CEICFrameWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch( uMsg ) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(UI_BUILD_FOR_WIN32) && !defined(UI_BUILD_FOR_WINCE) case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; #endif case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; } if( bHandled ) return lRes; if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT NativeWindow::HandleMessages(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_ERASEBKGND: return OnEraseBkgnd(); case WM_TIMER: { OnTimer((UINT)wParam); } break; case WM_SIZE: { int cx = LOWORD(lParam); int cy = HIWORD(lParam); OnSize((UINT)wParam,cx,cy); } break; case WM_GETMINMAXINFO: { OnGetMinMaxInfo((MINMAXINFO *)lParam); } break; default: break;; } return CallWindowProc(old_window_proc_,hwnd_, message, wParam, lParam); }
static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Let Tab Control handle messages belonging to it if(TabCtrl_HandleMessages(GetDlgItem(hDlg, IDC_TAB), uMsg, wParam, lParam)) return TRUE; // Handle messages that have been passed to us switch(uMsg) { case WM_INITDIALOG: OnInitDialog(hDlg, lParam); return TRUE; case WM_SIZE: OnSize(hDlg, lParam); return FALSE; case WM_GETMINMAXINFO: OnGetMinMaxInfo(hDlg, lParam); return FALSE; case WM_WINDOWPOSCHANGED: case WM_DISPLAYCHANGE: RefreshScreenSize(hDlg); break; case WM_SETTINGCHANGE: if(wParam == SPI_SETWORKAREA) RefreshScreenSize(hDlg); break; case WM_TIMER: if(wParam == WM_TIMER_CHECK_MOUSE) OnTimerCheckMouse(hDlg); break; case WM_APC: OnApc(hDlg, lParam); return TRUE; case WM_COMMAND: return OnCommand(hDlg, HIWORD(wParam), LOWORD(wParam)); case WM_SYSCOMMAND: if(wParam == SC_HELP_ABOUT) OnHelpAbout(hDlg); break; case WM_NOTIFY: OnNotify(hDlg, (NMHDR *)lParam); break; case WM_DESTROY: OnDestroy(hDlg); break; } return FALSE; }
LRESULT CHelloWorld::HandleMessage( UINT uMsg, WPARAM wParam, LPARAM lParam ) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg ,wParam, lParam, bHandled); break; case WM_DESTROY: ::PostQuitMessage(0); bHandled = FALSE; break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: if (wParam == VK_ESCAPE) { OnClose(); } break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = true; OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes) != 0) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT EventMgr::OnMessage(UINT msg, WPARAM wParam, LPARAM lParam, bool& wasHandled) { wasHandled = false; if (WM_ENTERSIZEMOVE == msg) { inSizeMove = true; } if (WM_EXITSIZEMOVE == msg) { inSizeMove = false; } if (WM_SIZE == msg) { //int dx = LOWORD(lParam); //int dy = HIWORD(lParam); wndRoot->RequestLayout(); return 0; } wndRoot->LayoutIfRequested(); if (WM_SETCURSOR == msg) { POINT pt; if (GetCursorPos(&pt) && ScreenToClient(wndRoot->hwndParent, &pt)) return OnSetCursor(pt.x, pt.y, wasHandled); return 0; } if (WM_MOUSEMOVE == msg) { int x = GET_X_LPARAM(lParam); int y = GET_Y_LPARAM(lParam); return OnMouseMove(wParam, x, y, wasHandled); } if (WM_LBUTTONUP == msg) { int x = GET_X_LPARAM(lParam); int y = GET_Y_LPARAM(lParam); return OnLButtonUp(wParam, x, y, wasHandled); } if (WM_GETMINMAXINFO == msg) { return OnGetMinMaxInfo((MINMAXINFO*)lParam, wasHandled); } if (WM_PAINT == msg) { wndRoot->OnPaint(wndRoot->hwndParent); wasHandled = true; return 0; } return 0; }
LRESULT CWin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(WIN32) && !defined(UNDER_CE) //case WM_NCCREATE: lRes = OnNcCreate(uMsg, wParam, lParam, bHandled); break; case WM_NCMOUSEMOVE: lRes = OnNCMouseMove(uMsg, wParam, lParam, bHandled); break; case WM_NCMOUSELEAVE: lRes = OnNCMouseLeave(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break; #endif case WM_ERASEBKGND: lRes = OnEraseBkGnd(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_CHAR: lRes = OnChar(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break; case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEMOVE: lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break; case WM_MOUSELEAVE: lRes = OnMouseLeave(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEHOVER: lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break; case WM_HOTKEY: lRes = OnHotKey(uMsg, wParam, lParam, bHandled); break; // case WM_TIMER: lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;//OnTimer响应有小问题 case WM_MOVING: lRes = OnMoving(uMsg, wParam, lParam, bHandled); break; case WM_SIZING: lRes = OnSizing(uMsg, wParam, lParam, bHandled); break; case WM_SHOWWINDOW: lRes = OnShowWindow(uMsg, wParam, lParam, bHandled); break; case WM_COMMAND: lRes = OnCommand(uMsg, wParam, lParam, bHandled); break; // case WM_PAINT: lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;//OnPaint响应有问题 case WM_MENUCOMMAND: lRes = OnMenuCommand(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; lRes = ProcessWindowMessage(uMsg, wParam, lParam, bHandled); if (bHandled) return lRes; if(_paintManager && _paintManager->MessageHandler(uMsg,wParam,lParam,lRes)) return lRes; return __super::HandleMessage(uMsg,wParam,lParam); }
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(WIN32) && !defined(UNDER_CE) case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; #endif case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; break; } if (bHandled) return lRes; lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled); if (bHandled) return lRes; if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT imsdkDemoLogin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_TIMER: lRes = OnTimer(uMsg, wParam, lParam, bHandled); break; default: bHandled = FALSE; } if (bHandled) return lRes; if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
/** * Main window proc of this subclassing library * Set plresult to set the return value of the real window proc which called us. * Return true to prevent any further handling of this message. */ bool CMoveConstraint::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT * plresult) { if (m_bPropertyPage) { // pass PSN_SETACTIVE to parent (property sheet) if (m_hwndDlg && (WM_NOTIFY == msg) && (PSN_SETACTIVE == (((NMHDR *)lParam)->code))) { HWND hwndParent = GetParent(m_hwndDlg); NMHDR nmhdr = { hwndParent, 0, PSN_SETACTIVE }; SendMessage(hwndParent, WM_NOTIFY, 0, (LPARAM)&nmhdr); } } if (m_bPropertySheet) { if ((WM_NOTIFY == msg) && (PSN_SETACTIVE == (((NMHDR *)lParam)->code))) { CheckDeferredChildren(); } } if (WM_GETMINMAXINFO == msg) { OnGetMinMaxInfo(reinterpret_cast<LPMINMAXINFO>(lParam)); } else if (WM_SIZE == msg) { // 2000/03/10 - tried WM_EXITSIZEMOVE - no help for property page problem Resize(hWnd, (UINT)wParam /* x & y in lParam */); } else if (WM_PAINT == msg && PaintGrip()) { CPaintDC dc(CWnd::FromHandle(hWnd)); RECT rc = getGripRect(hWnd); dc.DrawFrameControl(&rc, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); } else if (WM_NCHITTEST == msg && !IsIconic(hWnd) && !IsZoomed(hWnd)) { if (OnNcHitTest(msg, wParam, lParam, plresult)) return true; } else if (WM_DESTROY == msg) { OnDestroy(); } else if (msg==WM_NOTIFY && TTN_NEEDTEXT==((NMHDR*)lParam)->code) { if (OnTtnNeedText((TOOLTIPTEXT*)lParam, plresult)) return true; } return false; }
static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { UINT nIDCtrl; UINT nIDNotify; // Dialog initialization switch(uMsg) { case WM_INITDIALOG: OnInitDialog(hDlg, lParam); return TRUE; case WM_SIZE: OnSize(hDlg); break; case WM_GETMINMAXINFO: OnGetMinMaxInfo(hDlg, lParam); break; case WM_NOTIFY: OnNotify(hDlg, (NMHDR *)lParam); break; case WM_COMMAND: nIDNotify = HIWORD(wParam); nIDCtrl = LOWORD(wParam); if(nIDNotify == BN_CLICKED) EndDialog(hDlg, nIDCtrl); break; case WM_DESTROY: OnDestroy(hDlg); break; } return FALSE; }
LRESULT CDuilib3dFrame::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; switch( uMsg ) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_USER+1: { CControlUI* pControl = (CControlUI*)lParam; pControl->SetVisible(true); }break; default: bHandled = FALSE; } if( bHandled ) { return lRes; } if( m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes) ) { return lRes; } return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
INT_PTR Dialog::DlgWndProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return OnInitDlg(wParam, lParam); case WM_COMMAND: return OnCommand(wParam, lParam); case WM_NOTIFY: return OnNotify(wParam, lParam); case WM_TIMER: return OnTimer(wParam, lParam); case WM_CLOSE: return OnClose(wParam, lParam); case WM_DESTROY: return OnDestroy(wParam, lParam); case WM_SIZE: return OnSize(wParam, lParam); case WM_GETMINMAXINFO: return OnGetMinMaxInfo(wParam, lParam); } return (INT_PTR)FALSE; }
LRESULT CPdnWnd::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(uMsg == WM_FORWARDMSG) { return OnForwardMessage(hWnd, uMsg, wParam, lParam); } else if(uMsg == WM_CREATE) { m_hWnd = hWnd; return OnCreate(uMsg, wParam, lParam); } else if(uMsg == WM_CLOSE) { return OnClose(uMsg, wParam, lParam); } else if(uMsg == WM_DESTROY) { return OnDestroy(uMsg, wParam, lParam); } else if(uMsg == WM_JSINVOKE) { return OnJSInvoke(uMsg, wParam, lParam); } else if(uMsg == WM_GETMINMAXINFO) { return OnGetMinMaxInfo(uMsg, wParam, lParam); } else if(uMsg == WM_ACTIVATE) { return OnActivate(uMsg, wParam, lParam); } else if(uMsg == WM_SIZE) { return OnSize(uMsg, wParam, lParam); } else if(uMsg == WM_COMMAND) { return OnCommand(uMsg, wParam, lParam); } else if(uMsg == WM_ENDSESSION) { return OnEndSession(uMsg, wParam, lParam); } else if(uMsg == WM_NCDESTROY) { OnFinalMessage(m_hWnd, uMsg, wParam, lParam); return ::DefWindowProc(m_hWnd, uMsg, wParam, lParam); } else if(uMsg == m_TaskbarRestartMessage) { return OnTaskbarRestart(uMsg, wParam, lParam); } else if(uMsg == WM_COPYDATA) { return OnCopyData(uMsg, wParam, lParam); } else if(uMsg == WM_NOTIFYICON) { return OnNotifyIcon(uMsg, wParam, lParam); } else if(uMsg == WM_PARENTNOTIFY && wParam == WM_DESTROY) { return ::DestroyWindow(m_hWnd); } else if(uMsg == WM_SYSCOMMAND) { return OnSysCommand(uMsg, wParam, lParam); } else if(uMsg == 0x02B1 /*WM_WTSSESSION_CHANGE*/) { return OnWTSSessionChange(uMsg, wParam, lParam); } else if(uMsg == WM_ENTERMENULOOP) { m_hasModalDialog = true; return ::DefWindowProc(m_hWnd, uMsg, wParam, lParam); } else if(uMsg == WM_EXITMENULOOP) { m_hasModalDialog = false; return ::DefWindowProc(m_hWnd, uMsg, wParam, lParam); } else { return ::DefWindowProc(m_hWnd, uMsg, wParam, lParam); } }
INT_PTR Dialog::DialogProcDefault(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CLOSE: { return OnClose(); } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDOK: OnOK(); return TRUE; case IDCANCEL: OnCancel(); return TRUE; default: return OnCommand(wParam, lParam); } break; } case WM_CONTEXTMENU: { POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; OnContextMenu(reinterpret_cast<HWND>(wParam), pt); break; } case WM_DESTROY: { OnDestroy(); break; } case WM_INITDIALOG: { #ifdef TAIGA_WIN_DIALOG_REMEMBER_LAST_POSITION_AND_SIZE if (pos_last_.x && pos_last_.y) SetPosition(nullptr, pos_last_.x, pos_last_.y, 0, 0, SWP_NOSIZE); if (size_last_.cx && size_last_.cy) SetPosition(nullptr, 0, 0, size_last_.cx, size_last_.cy, SWP_NOMOVE); #endif return OnInitDialog(); } case WM_DROPFILES: { OnDropFiles(reinterpret_cast<HDROP>(wParam)); break; } case WM_ENTERSIZEMOVE: case WM_EXITSIZEMOVE: { SIZE size = {0}; OnSize(uMsg, 0, size); break; } case WM_GETMINMAXINFO: { LPMINMAXINFO mmi = reinterpret_cast<LPMINMAXINFO>(lParam); SetMinMaxInfo(mmi); OnGetMinMaxInfo(mmi); break; } case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: case WM_MOUSEACTIVATE: case WM_MOUSEHOVER: case WM_MOUSEHWHEEL: case WM_MOUSELEAVE: case WM_MOUSEMOVE: case WM_MOUSEWHEEL: { LRESULT result = OnMouseEvent(uMsg, wParam, lParam); if (result != -1) { ::SetWindowLongPtrW(hwnd, DWL_MSGRESULT, result); return TRUE; } break; } case WM_MOVE: { POINTS pts = MAKEPOINTS(lParam); OnMove(&pts); break; } case WM_NOTIFY: { LRESULT result = OnNotify(wParam, reinterpret_cast<LPNMHDR>(lParam)); if (result) { ::SetWindowLongPtr(hwnd, DWL_MSGRESULT, result); return TRUE; } break; } case WM_PAINT: { if (::GetUpdateRect(hwnd, nullptr, FALSE)) { PAINTSTRUCT ps; HDC hdc = ::BeginPaint(hwnd, &ps); OnPaint(hdc, &ps); ::EndPaint(hwnd, &ps); } else { HDC hdc = ::GetDC(hwnd); OnPaint(hdc, nullptr); ::ReleaseDC(hwnd, hdc); } break; } case WM_SIZE: { SIZE size = {LOWORD(lParam), HIWORD(lParam)}; OnSize(uMsg, static_cast<UINT>(wParam), size); break; } case WM_TIMER: { OnTimer(static_cast<UINT_PTR>(wParam)); break; } case WM_WINDOWPOSCHANGING: { LPWINDOWPOS window_pos = reinterpret_cast<LPWINDOWPOS>(lParam); SnapToEdges(window_pos); OnWindowPosChanging(window_pos); break; } default: { if (uMsg == WM_TASKBARCREATED || uMsg == WM_TASKBARBUTTONCREATED || uMsg == WM_TASKBARCALLBACK) { OnTaskbarCallback(uMsg, lParam); return FALSE; } break; } } return FALSE; }
BOOL CSonicSkin::OnWndMsg(UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_DRAWITEM: { return OnDrawItem((LPDRAWITEMSTRUCT)lParam); } break; case WM_CTLCOLORSTATIC: { return OnCtlColorStatic((HDC)wParam, (HWND)lParam); } break; case WM_CTLCOLORBTN: { return OnCtlColorBtn((HDC)wParam, (HWND)lParam); } break; case WM_LBUTTONDBLCLK: { int x = LOWORD(lParam); int y = HIWORD(lParam); if(y < m_bg.wTitleHeight) { SendMessage(m_hWnd, WM_NCLBUTTONDBLCLK, HTCAPTION, 0); return FALSE; } } break; case WM_LBUTTONDOWN: { int x = LOWORD(lParam); int y = HIWORD(lParam); if(y < m_bg.wTitleHeight && m_bg.bEnableDrag) { SendMessage(m_hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); return FALSE; } } break; case WM_NCHITTEST: { return OnNCHittest(LOWORD(lParam), HIWORD(lParam)); } break; // assure the none-border window wont override the tray bar case WM_GETMINMAXINFO: { return OnGetMinMaxInfo((MINMAXINFO *)lParam); } break; case WM_WINDOWPOSCHANGING: { return OnPosChanging((LPWINDOWPOS)lParam); } break; case WM_WINDOWPOSCHANGED: { return OnPosChanged((LPWINDOWPOS)lParam); } break; case WM_ERASEBKGND: { return OnEraseBackground((HDC)wParam); } break; // erase NC paint case WM_NCACTIVATE: g_UI.SetCallWndProcRet(TRUE); return FALSE; case WM_NCPAINT: SetRgn(); case WM_NCCALCSIZE: g_UI.SetCallWndProcRet(0); return FALSE; } return TRUE; }
INT_PTR CMessageForwarder::ForwardMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { m_hwnd = hwnd; m_uMsg = uMsg; m_wParam = wParam; m_lParam = lParam; /* Private message? */ if(uMsg > WM_APP && uMsg < 0xBFFF) { return OnPrivateMessage(uMsg,wParam,lParam); } switch(uMsg) { case WM_INITDIALOG: return OnInitDialog(); break; case WM_CTLCOLORSTATIC: return OnCtlColorStatic(reinterpret_cast<HWND>(lParam), reinterpret_cast<HDC>(wParam)); break; case WM_CTLCOLOREDIT: return OnCtlColorEdit(reinterpret_cast<HWND>(lParam), reinterpret_cast<HDC>(wParam)); break; case WM_HSCROLL: return OnHScroll(reinterpret_cast<HWND>(lParam)); break; case WM_APPCOMMAND: return OnAppCommand(reinterpret_cast<HWND>(wParam), GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); break; case WM_TIMER: return OnTimer(static_cast<int>(wParam)); break; case WM_MBUTTONUP: return OnMButtonUp(&MAKEPOINTS(lParam)); break; case WM_COMMAND: return OnCommand(wParam,lParam); break; case WM_NOTIFY: return OnNotify(reinterpret_cast<LPNMHDR>(lParam)); break; case WM_GETMINMAXINFO: return OnGetMinMaxInfo(reinterpret_cast<LPMINMAXINFO>(lParam)); break; case WM_SIZE: return OnSize(static_cast<int>(wParam), LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: return OnClose(); break; case WM_DESTROY: return OnDestroy(); break; case WM_NCDESTROY: return OnNcDestroy(); break; case EM_SETSEL: OnEMSetSel(wParam,lParam); break; } return GetDefaultReturnValue(hwnd,uMsg,wParam,lParam); }
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = TRUE; CPoint pt; switch (uMsg) { case WM_CREATE: lRes = OnCreate(uMsg, wParam, lParam, bHandled); break; case WM_CLOSE: lRes = OnClose(uMsg, wParam, lParam, bHandled); break; case WM_DESTROY: lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break; #if defined(WIN32) && !defined(UNDER_CE) case WM_NCACTIVATE: lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break; case WM_NCCALCSIZE: lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break; case WM_NCPAINT: lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break; case WM_NCHITTEST: lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break; case WM_GETMINMAXINFO: lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break; case WM_MOUSEWHEEL: { pt.x = GET_X_LPARAM( lParam ); pt.y = GET_Y_LPARAM( lParam ); lRes = OnMouseWheel(uMsg,GET_KEYSTATE_WPARAM(wParam),GET_WHEEL_DELTA_WPARAM(wParam),pt,bHandled); break; } #endif case WM_SIZE: lRes = OnSize(uMsg, wParam, lParam, bHandled); break; case WM_CHAR: lRes = OnChar(uMsg, wParam, lParam, bHandled); break; case WM_SYSCOMMAND: lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break; case WM_KEYDOWN: { lRes = OnKeyDown( uMsg,wParam, lParam&0xff, lParam>>16 ,bHandled); break; } case WM_KEYUP: { lRes = OnKeyUp(uMsg, wParam, lParam&0xff, lParam>>16,bHandled ); break; } case WM_SYSKEYDOWN: { lRes=OnSysKeyDown(uMsg,wParam,lParam&0xff,lParam>>16,bHandled); break; } case WM_SYSKEYUP: { lRes=OnSysKeyUp(uMsg,wParam,lParam&0xff,lParam>>16,bHandled); break; } case WM_KILLFOCUS: lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break; case WM_SETFOCUS: lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONUP: lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break; case WM_LBUTTONDOWN: lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break; case WM_RBUTTONDOWN: { lRes = OnRButtonDown(uMsg,wParam,lParam,bHandled); break; } case WM_RBUTTONUP: { lRes = OnRButtonUp(uMsg,wParam,lParam,bHandled); break; } case WM_MOUSEMOVE: { pt.x = GET_X_LPARAM( lParam ); pt.y = GET_Y_LPARAM( lParam ); lRes = OnMouseMove(uMsg, wParam, pt, bHandled); break; } case WM_MOUSEHOVER: { lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break; } #if(WINVER >= 0x0601) case WM_TOUCH: { UINT cInputs = LOWORD(wParam); HTOUCHINPUT hTouchInput=(HTOUCHINPUT)lParam; lRes = OnTouch(uMsg, cInputs, hTouchInput, bHandled); //If the application does not process the message, it must call DefWindowProc if (lRes==FALSE) { ::DefWindowProc(*this,uMsg,wParam,lParam); } break; } #endif #if(WINVER >= 0x0602) case WM_POINTERUP: { lRes = OnPointerUp(uMsg,wParam,lParam,bHandled); break; } case WM_POINTERDOWN: { lRes = OnPointerDown(uMsg,wParam,lParam,bHandled); break; } #endif default: { bHandled = FALSE; break; } } if (bHandled) { return lRes; } lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled); if(bHandled) { return lRes; } if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes)) { return lRes; } return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT CSkinWin::WindowProc(UINT msg, WPARAM wp, LPARAM lp) { if ( !IsWindow(m_hWnd) ) return 0; if ( !m_bInit ) return Default(); switch ( msg ) { case WM_SHOWWINDOW: //call setwindowpos to force OnNcCalcSize when hWnd is a dialog if ( wp ) SetWindowPos( m_hWnd, 0, 0, 0, 400, 400, SWP_NOSIZE|SWP_NOMOVE|SWP_FRAMECHANGED ); Default(); return 0; break; //case WM_ERASEBKGND: case WM_INITMENUPOPUP: Default(); return 0; // return OnEraseBkgnd(CDC::FromHandle((HDC)wp) ); /* case WM_INITMENU: //a hack, when popup sysmenu, redraw title bar HMENU h; h = (HMENU)wp; int c; h = GetSubMenu(h, 0); c = GetMenuItemID( h, 0 ); if ( c == SC_RESTORE ) { CRect r; GetClientRect( m_hWnd, r ); OnNcPaint(0); r.bottom = GetSystemMetrics(SM_CYCAPTION); InvalidateRect( m_hWnd, r, TRUE ); UpdateWindow( m_hWnd ); } Default(); return 0; */ case WM_SYSCOMMAND: OnSysCommand( wp, lp ); return 0; case WM_SETTEXT: return OnSetText( wp, lp ); case WM_NCPAINT: OnNcPaint( (HRGN)wp ); return 0; case WM_NCCALCSIZE: OnNcCalcSize( (BOOL)wp, (NCCALCSIZE_PARAMS *)lp ); return 0; case WM_SIZE: OnSize( wp, LOWORD(lp), HIWORD(lp) ); return 0; case WM_NCACTIVATE: return OnNcActivate( (BOOL)wp ); case WM_NCHITTEST: return OnNcHitTest(CPoint(LOWORD(lp), HIWORD(lp))); case WM_NCLBUTTONUP: OnNcLButtonUp(wp, CPoint(LOWORD(lp), HIWORD(lp))); return 0; case WM_NCLBUTTONDOWN: OnNcLButtonDown(wp, CPoint(LOWORD(lp), HIWORD(lp))); return 0; /* case WM_NCLBUTTONDBLCLK: OnNcLButtonDblClk(wp, CPoint(LOWORD(lp), HIWORD(lp))); return 0;*///liub_modify (去除双击弹出面板的响应事件) case WM_NCRBUTTONUP: OnNcRButtonUp(wp, CPoint(LOWORD(lp), HIWORD(lp))); return 0; case WM_NCRBUTTONDOWN: OnNcRButtonDown(wp, CPoint(LOWORD(lp), HIWORD(lp))); return 0; case WM_NCMOUSEMOVE: OnNcMouseMove( wp,CPoint(LOWORD(lp), HIWORD(lp))); return 0; case WM_GETMINMAXINFO: OnGetMinMaxInfo( (MINMAXINFO *)lp ); return 0; case WM_WINDOWPOSCHANGING: OnWindowPosChanging((WINDOWPOS *)lp); return 0; case WM_SIZING: OnSizing( wp, (LPRECT)lp ); return 0; case WM_ACTIVATE: OnActivate( wp, CWnd::FromHandle((HWND)lp), 0 ); return 0; case WM_COMMAND: if ( !HandleSysCommand( wp, lp ) ) Default(); return 0; #if 1 // @@ case WM_SETCURSOR: if (OnHitTestSetCursor(LOWORD(lp))) OnNcPaint(0); else Default(); return 0; #endif default: return Default(); } }