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); }
void NNIMTaskBarIcon::OnCommandEvent(wxCommandEvent &event) { OnMenuCommand(event.GetId()); }
void wxMFrame::OnCommandEvent(wxCommandEvent &event) { OnMenuCommand(event.GetId()); }
//-------------------------------------------------------------------------------- bool CMenuController::ProcessMessage( COSWindow& Window, Cmp_long_ptr& lResult, unsigned int uMsg, Cmp_uint_ptr wParam, Cmp_long_ptr lParam ) { _WINQ_FCONTEXT( "CMenuController::ProcessMessage" ); bool bProcessed = ProcessHook( Window, lResult, uMsg, wParam, lParam ); switch ( uMsg ) { case COSWindow::wmContextMenu: { COSWindow::refType refWnd = COSWindow::FromHandle( CWindowHandle( 0, (void*)(wParam) ).Ref() ); unsigned short wXPos = LoWord( lParam ); unsigned short wYPos = HiWord( lParam ); OnContextMenu( Window, refWnd, wXPos, wYPos ); bProcessed = true; } break; case COSWindow::wmInitMenu: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)(wParam) ).Ref() ); OnInitMenu( Window, refMenu ); lResult = 0; bProcessed = true; } break; case COSWindow::wmInitMenuPopup: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( wParam ) ).Ref() ); unsigned short wPos = LoWord( lParam ); int bWindowMenu = static_cast< int >( HiWord( lParam ) ); OnInitMenuPopup( Window, refMenu, wPos, bWindowMenu ? true : false ); lResult = 0; bProcessed = true; } break; #if ( WINVER >= 0x0500 ) case COSWindow::wmUninitMenuPopup: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)(wParam) ).Ref() ); unsigned short wDestroyedMenu = HiWord( lParam ); OnDestroyedMenuPopup( Window, refMenu, wDestroyedMenu ); bProcessed = true; } break; #endif//( WINVER >= 0x0500 ) case COSWindow::wmMenuSelect: { unsigned short wIndex = LoWord( wParam ); unsigned short wFlags = HiWord( wParam ); CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() ); OnMenuSelect( Window, refMenu, wIndex, wFlags ); lResult = 0; bProcessed = true; } break; case COSWindow::wmMenuChar: { unsigned short wCharCode = LoWord( wParam ); unsigned short wMenuType = HiWord( wParam ); CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() ); lResult = OnMenuChar( Window, refMenu, wCharCode, wMenuType ); bProcessed = true; } break; case COSWindow::wmNextMenu: { MDINextMenu* pNextMenu = reinterpret_cast< MDINextMenu* >( lParam ); CMenu::refType refMenuIn = CMenu::FromHandle( CMenuHandle( 0, (void*)( pNextMenu->hmenuIn ) ).Ref() ); CMenu::refType refMenuNext = CMenu::FromHandle( CMenuHandle( 0, (void*)( pNextMenu->hmenuNext ) ).Ref() ); OnNextMenu( Window, wParam, refMenuIn, refMenuNext ); bProcessed = true; } break; #if ( WINVER >= 0x0500 ) case COSWindow::wmMenuGetObject: { MenuGetObjectInfo* pMenuObjectInfo = reinterpret_cast< MenuGetObjectInfo* >( lParam ); lResult = OnGetObject( Window, pMenuObjectInfo ); bProcessed = true; } break; case COSWindow::wmMenuRButtonUp: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() ); OnRButtonUp( Window, refMenu, wParam ); bProcessed = true; } break; case COSWindow::wmMenuCommand: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() ); unsigned short wItemID = static_cast< unsigned short >( -1 ); int iIndex = 0; if( System().Information(QOR_PP_SHARED_OBJECT_ACCESS).IsWindows98orME() ) { wItemID = LoWord( wParam ); iIndex = static_cast< int >( HiWord( wParam ) ); } else { iIndex = wParam; } OnMenuCommand( Window, refMenu, iIndex, wItemID ); bProcessed = true; } break; case COSWindow::wmMenuDrag: { CMenu::refType refMenu = CMenu::FromHandle( CMenuHandle( 0, (void*)( lParam ) ).Ref() ); lResult = OnMenuDrag( Window, refMenu, static_cast< unsigned short >( wParam ) ); bProcessed = true; } break; #endif//( WINVER >= 0x0500 ) case COSWindow::wmCommand: { unsigned short wCode = HiWord( wParam ); if( wCode == 0 ) { unsigned short wMenuID = LoWord( wParam ); OnCommand( Window, wMenuID ); lResult = 0; bProcessed = true; } } break; } return bProcessed; }