LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0; BOOL bHandled = FALSE; if( uMsg == WM_CREATE ) { m_pm.Init(m_hWnd); CDialogBuilder builder; CControlUI* pRoot = builder.Create(_T("test1.xml"), (UINT)0, NULL, &m_pm); ASSERT(pRoot && "Failed to parse XML"); m_pm.AttachDialog(pRoot); m_pm.AddNotifier(this); Init(); return 0; } else if( uMsg == WM_DESTROY ) { ::PostQuitMessage(0L); } else if( uMsg == WM_ERASEBKGND ) { return 1; } else if( uMsg == WM_CLOSE) { lRes = OnClose(uMsg, wParam, lParam, bHandled); } else if(uMsg == WM_SYSCOMMAND) { lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); } if( bHandled ) return lRes; if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes; return CWindowWnd::HandleMessage(uMsg, wParam, lParam); }
LRESULT CALLBACK VideoWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { //HANDLE_MSG(hWnd, WM_CREATE, OnCreate); //HANDLE_MSG(hWnd, WM_SIZE, OnSize); HANDLE_MSG(hWnd, WM_MDIACTIVATE, OnMDIActivate); HANDLE_MSGB(hWnd, WM_PAINT, OnPaint); HANDLE_MSG(hWnd, WM_MOUSEMOVE, OnMouseMove); HANDLE_MSG(hWnd, WM_LBUTTONUP, OnLButtonUp); HANDLE_MSG(hWnd, WM_LBUTTONDOWN, OnLButtonDown); HANDLE_MSG(hWnd, WM_LBUTTONDBLCLK, OnLButtonDblClk); HANDLE_MSG(hWnd, WM_RBUTTONUP, OnRButtonUp); HANDLE_MSG(hWnd, WM_RBUTTONDBLCLK, OnRButtonDown); HANDLE_MSG(hWnd, WM_RBUTTONDOWN, OnRButtonDown); // We can't use the macro from windowsx.h macro for this one case WM_SYSCOMMAND: { if (OnSysCommand(hWnd,(UINT)wParam,(int)(short)LOWORD(lParam),(int)(short)HIWORD(lParam))) { return 0; } break; } default: return DefMDIChildProc(hWnd, Msg, wParam, lParam); } return 0; }
//窗口处理函数 LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { case WM_CONTEXTMENU: OnContextMenu( hWnd, lParam ); break; case WM_COMMAND: OnCommand( hWnd, wParam ); break; case WM_RBUTTONUP: OnRButtonUp( hWnd, lParam ); break; case WM_SYSCOMMAND: OnSysCommand( hWnd, wParam ); break; case WM_CREATE: OnCreate( hWnd ); break; case WM_DESTROY: PostQuitMessage( 0 ); break; } return DefWindowProc( hWnd, msg, 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); }
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); }
void CWindow::WinProc (unsigned int msg, WPARAM wParam, LPARAM lParam) #endif { switch (msg) { case WM_CREATE: OnCreate (m_hWnd, wParam, lParam); break; case WM_INITDIALOG: OnInitDialog (wParam, lParam); break; case WM_ACTIVATEAPP: OnActivateApp (wParam, lParam); break; case WM_SIZE: OnSize (wParam, lParam); break; case WM_MOVE: OnMove (wParam, lParam); break; case WM_PAINT: OnPaint (wParam, lParam); break; case WM_KEYDOWN: OnKeyDown (wParam, lParam); break; case WM_KEYUP: OnKeyUp (wParam, lParam); break; case WM_COMMAND: OnCommand (wParam, lParam); break; case WM_SYSCOMMAND: OnSysCommand (wParam, lParam); break; case WM_CLOSE: OnClose (wParam, lParam); break; case WM_DESTROY: OnDestroy (wParam, lParam); break; #ifndef WIN32 case SDL_JOYAXISMOTION: OnJoystickAxis(wParam, lParam); break; case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: OnJoystickButton(wParam, lParam); break; #endif } #ifdef WIN32 return DefWindowProc (m_hWnd, msg, wParam, lParam); #else return; #endif }
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 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 CView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { // This function is our message procedure. We process the messages for // the view window here. Unprocessed messages are passed on for // default processing. switch(uMsg) { case WM_SIZE: return OnSize(); case WM_SYSCOMMAND: return OnSysCommand(wParam, lParam); case MSG_TRAYICON: return OnTrayIcon(wParam, lParam); } // pass unhandled messages on for default processing return WndProcDefault(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); }
LONG CSaverWnd::WndProc(UINT a_uMsg, WPARAM a_wParam, LPARAM a_lParam) { switch (a_uMsg) { case WM_NCCREATE: return OnNCCreate(reinterpret_cast<CREATESTRUCT*>(a_lParam)) ; case WM_CREATE: return OnCreate(reinterpret_cast<CREATESTRUCT*>(a_lParam)) ? 0L : -1L ; case WM_ACTIVATEAPP: return OnActivateApp(a_wParam, a_lParam) ? 0L : -1L ; case WM_DESTROY: OnDestroy() ; return 0L ; case WM_NCDESTROY: OnNCDestroy() ; return 0L ; case WM_PAINT: return OnPaint() ? 0L : -1L ; case WM_MOUSEMOVE: POINT pt ; pt.x = LOWORD(a_lParam) ; pt.y = HIWORD(a_lParam) ; OnMouseMove(a_wParam, pt) ; return 0 ; case WM_SYSCOMMAND: if (OnSysCommand(a_wParam, a_lParam)) { return 0 ; } break ; } return ::DefWindowProc(m_hWnd, a_uMsg, a_wParam, a_lParam) ; }
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); }
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(); } }
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); } }
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); }
//--------------------------------------------------------------------- // ClientWindowProc(): //--------------------------------------------------------------------- LRESULT WPPALLETE::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Process window message. switch (uMsg) { case WM_CREATE: // Store the window handle for use later. SetHandle(hWnd); // Let notebook object know that create message is being processed. // NOTE: Here is where folder objects have a chance to animate // the zoom effect for window creation. OnCreate(); // Return success so we can continue with the creation of window. return ((LRESULT)0); case WM_ACTIVATE: OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE)); return (TRUE); case WM_COMMAND: OnCommand((HWND)LOWORD(lParam),HIWORD(lParam)); break; case WM_SYSCOMMAND: // A system command has been requested. OnSysCommand((WORD)wParam,lParam); break; case WM_SETTEXT: // Set new window caption text. DefWindowProc(hWnd,uMsg,wParam,lParam); // Update window caption. OnNCPaint(); break; case WM_QUERYDRAGICON: return (OnQueryDragIcon()); case WM_ERASEBKGND: OnEraseBackground((HDC)wParam); break; case WM_PAINT: OnPaint(); break; case WM_NCACTIVATE: // Handle this message ONLY if the non-client area is becoming active OR // the window becoming active or inactive is not a notebook page (modeless dialog). // else, do not update non-client area to prevent flickering effect with // notebook window caption. OnNCActivate((BOOL)wParam); return (TRUE); case WM_NCPAINT: OnNCPaint(); return (NULL); case WM_NCMOUSEMOVE: OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam)); break; case WM_NCLBUTTONUP: case WM_NCLBUTTONDOWN: OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam)); break; case WM_MOUSEMOVE: OnMouseMove(); break; case WM_MOVE: OnMove(MAKEPOINT(lParam)); break; case WM_SIZE: OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: OnClose(); break; default: // Call the default window procedure. return (DefWindowProc(hWnd,uMsg,wParam,lParam)); } // We are done processing the window message... return (NULL); }
/** * Windows プロシージャ (WindowProc) を提供します * @param[in] message 処理される Windows メッセージを指定します * @param[in] wParam メッセージの処理に使用する追加情報を提供します * @param[in] lParam メッセージの処理に使用する追加情報を提供します * @return 戻り値は、メッセージによって異なります */ LRESULT CTraceWnd::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam) { switch (nMsg) { case WM_CREATE: return OnCreate(reinterpret_cast<LPCREATESTRUCT>(lParam)); case WM_SYSCOMMAND: OnSysCommand(wParam, lParam); return DefWindowProc(nMsg, wParam, lParam); case WM_ENTERMENULOOP: OnEnterMenuLoop(wParam); break; case WM_MOVE: if (!(GetStyle() & (WS_MAXIMIZE | WS_MINIMIZE))) { RECT rc; GetWindowRect(&rc); tracecfg.posx = rc.left; tracecfg.posy = rc.top; } break; case WM_SIZE: // window resize if (!(GetStyle() & (WS_MAXIMIZE | WS_MINIMIZE))) { RECT rc; GetWindowRect(&rc); tracecfg.width = rc.right - rc.left; tracecfg.height = rc.bottom - rc.top; } m_wndView.MoveWindow(0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_SETFOCUS: m_wndView.SetFocus(); break; case WM_CTLCOLORSTATIC: case WM_CTLCOLOREDIT: SetTextColor((HDC)wParam, VIEW_FGCOLOR); SetBkColor((HDC)wParam, VIEW_BGCOLOR); return reinterpret_cast<LRESULT>(m_hBrush); case WM_CLOSE: break; case WM_DESTROY: if (m_hBrush) { ::DeleteObject(m_hBrush); m_hBrush = NULL; } if (m_hFont) { ::DeleteObject(m_hFont); m_hFont = NULL; } break; #if 0 case WM_ENTERSIZEMOVE: winloc_movingstart(); break; case WM_MOVING: winloc_movingproc((RECT *)lParam); break; case WM_ERASEBKGND: break; #endif default: return DefWindowProc(nMsg, wParam, lParam); } return FALSE; }
DWORD Window::WndProc( UINT message, WPARAM wParam, LPARAM lParam ) { switch (message) { case WM_CLOSE: OnClose(); return 0; case WM_DESTROY: OnDestroy(); return 0; case WM_PAINT: PAINTSTRUCT paint; BeginPaint(GetHWND(), &paint); OnPaint(paint.hdc, paint.rcPaint); EndPaint(GetHWND(), &paint); return 0; case WM_MOVE: case WM_SIZE: UpdateRect(); RectChanged(); break; case WM_TIMER: if (OnTimer()) return 0; break; case WM_HSCROLL: if (OnHScroll((int)LOWORD(wParam), (short int) HIWORD(wParam), (HWND)lParam)) return 0; break; case WM_VSCROLL: if (OnVScroll((int)LOWORD(wParam), (short int) HIWORD(wParam), (HWND)lParam)) return 0; break; case WM_COMMAND: if (OnCommand(wParam, lParam)) return 0; break; case WM_SYSCOMMAND: if (OnSysCommand(wParam & 0xFFF0, MakePoint(lParam))) return 0; break; case WM_ACTIVATE: if (OnActivate(LOWORD(wParam), HIWORD(wParam) != 0)) return 0; break; case WM_ACTIVATEAPP: if (OnActivateApp(wParam != 0)) return 0; break; case WM_CHAR: { KeyState ks; ks.vk = wParam; ks.bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; ks.bControl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; ks.countRepeat = LOWORD(lParam); return !OnChar(ks); } break; case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: { KeyState ks; ks.vk = wParam; ks.bShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; ks.bControl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; ks.bAlt = (message == WM_SYSKEYUP || message == WM_SYSKEYDOWN) && (lParam & (1 << 29)); // See help for WM_SYSKEYDOWN ks.bDown = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN); ks.countRepeat = LOWORD(lParam); return !OnKey(ks); } break; case WM_MOUSEWHEEL: //imago 8/13/09 case WM_XBUTTONDOWN: case WM_XBUTTONUP: case WM_MOUSEHOVER: // imago --^ case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: case WM_MOUSEMOVE: case WM_MOUSELEAVE: case WM_NCMOUSEHOVER: //Imago 7/10 case WM_NCMOUSELEAVE: //<--^ { WinPoint pointMouse; if (message != WM_MOUSEWHEEL) { WinPoint point(MakePoint(lParam)); pointMouse = WinPoint(point.X(),m_rectClient.YSize() - 1 - point.Y()); m_lastPointMouse = pointMouse; } else { pointMouse = m_lastPointMouse; } // // Handle mouse leave // if (message == WM_MOUSELEAVE || message == WM_NCMOUSELEAVE) { if (m_bMouseInside) { m_bMouseInside = false; OnMouseMessage(WM_MOUSELEAVE, 0, pointMouse); } } else { // // Handle mouse enter // if (!m_bMouseInside && (message != WM_NCMOUSEHOVER && message != WM_MOUSEHOVER && message != 0)) { m_bMouseInside = true; OnMouseMessage(0, 0, pointMouse); if (s_pfnTrackMouseEvent) { TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; tme.hwndTrack = m_hwnd; tme.dwHoverTime = HOVER_DEFAULT; ZVerify(s_pfnTrackMouseEvent(&tme)); } } // // Handle the mouse message // DWORD ret = OnMouseMessage(message, wParam, pointMouse) ? 0 : 1; } return true; } break; case WM_SETCURSOR: // // use the custom cursor for the client area // if (LOWORD(lParam) == HTCLIENT) { ::SetCursor(NULL); } else { ::SetCursor(GetCursor()); } break; case WM_WINDOWPOSCHANGING: if (OnWindowPosChanging((LPWINDOWPOS)lParam)) return 0; break; } return m_pfnWndProc(m_hwnd, message, wParam, lParam); }
//--------------------------------------------------------------------- // ClientWindowProc(): //--------------------------------------------------------------------- LRESULT WPNOTEBOOK::ClientWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // Process window message. switch (uMsg) { case WM_CREATE: // Store the window handle for use later. SetHandle(hWnd); // Let notebook object know that create message is being processed. // NOTE: Here is where folder objects have a chance to animate // the zoom effect for window creation. OnCreate(); // Return success so we can continue with the creation of window. return ((LRESULT)0); case WM_ACTIVATE: OnActivate(((wParam==WA_INACTIVE)? TRUE : FALSE)); return (TRUE); // We don't want the client area to have the focus, since it // doesn't accept input. When it gets the focus, which it will // when the window is restored from a minimized state, for // instance, post a user message to ourselves to reset the // focus to the notebook. Posting the message is necessary // because the focus shouldn't be tampered with when processing // a WM_SETFOCUS or WM_KILLFOCUS message. case WM_SETFOCUS: PostMessage(hWnd,WM_WPS_NOTEBOOK_SETFOCUS,0,0L); break; case WM_WPS_NOTEBOOK_SETFOCUS: // Give focus to notebook control in our client area. SetFocus(GetDlgItem(hWnd,IDC_NOTEBOOK)); break; case WM_COMMAND: if (wParam==IDC_NOTEBOOK) OnCommand((HWND)LOWORD(lParam),HIWORD(lParam)); break; case WM_SYSCOMMAND: // A system command has been requested. OnSysCommand((WORD)wParam,lParam); break; case WM_SETTEXT: // Set new window caption text. DefWindowProc(hWnd,uMsg,wParam,lParam); // Update window caption. OnNCPaint(); break; case WM_QUERYDRAGICON: return (OnQueryDragIcon()); case WM_ERASEBKGND: OnEraseBackground((HDC)wParam); break; case WM_NCACTIVATE: // Handle this message ONLY if the non-client area is becoming active OR // the window becoming active or inactive is not a notebook page (modeless dialog). // else, do not update non-client area to prevent flickering effect with // notebook window caption. if ((((BOOL)wParam)==TRUE)||(IsPageWindow((HWND)LOWORD(lParam))==FALSE)) OnNCActivate((BOOL)wParam); return (TRUE); case WM_NCPAINT: OnNCPaint(); return (NULL); case WM_NCMOUSEMOVE: OnNCMouseMove((WORD)wParam,MAKEPOINT(lParam)); break; case WM_NCLBUTTONUP: case WM_NCLBUTTONDOWN: OnNCLButton(uMsg,(WORD)wParam,MAKEPOINT(lParam)); break; case WM_MOUSEMOVE: OnMouseMove(); break; case WM_MOVE: OnMove(MAKEPOINT(lParam)); break; case WM_SIZE: OnSize((WORD)wParam,LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: OnClose(); break; default: // Call the default window procedure. return (DefWindowProc(hWnd,uMsg,wParam,lParam)); } // We are done processing the window message... return (NULL); }