LRESULT CALLBACK ControlPad::WindowProc(UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_DISPLAYCHANGE: case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(m_hWnd, &ps); OnPaint(ps.hdc); EndPaint(m_hWnd, &ps); } return 0; case WM_ERASEBKGND: return 0; case WM_SIZE: OnSize(LOWORD(lParam), HIWORD(lParam)); return 0; case WM_RBUTTONUP: OnRightButtonUp(LOWORD(lParam), HIWORD(lParam)); return 0; case WM_MOUSEMOVE: OnMouseMove(LOWORD(lParam), HIWORD(lParam)); return 0; case WM_MOUSEWHEEL: //pCtrlPad->OnMouseWheel(HIWORD(wParam)); return 0; case WM_KEYDOWN: OnKeyDown(wParam); return 0; case WM_CLOSE: DestroyWindow(); return 0; default: return DefaultWindowProc(Msg, wParam, lParam); } return DefaultWindowProc(Msg, wParam, lParam); }
// WM_NCDESTROY handler // cleansup the data and unsubclasses the window // calls PostNcDestroy BOOL cef_window::HandleNcDestroy() { WNDPROC superWndProc = WNDPROC(GetWindowLongPtr(GWLP_WNDPROC)); RemoveProp(::gCefClientWindowPropName); DefaultWindowProc(WM_NCDESTROY, 0, 0); if ((WNDPROC(GetWindowLongPtr(GWLP_WNDPROC)) == superWndProc) && (mSuperWndProc != NULL)) SetWindowLongPtr(GWLP_WNDPROC, reinterpret_cast<INT_PTR>(mSuperWndProc)); mSuperWndProc = NULL; PostNcDestroy(); return TRUE; }
// Window Message Dispatching LRESULT cef_window::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_NCDESTROY: if (HandleNcDestroy()) return 0L; break; } LRESULT lr = DefaultWindowProc(message, wParam, lParam); if (message == WM_NCDESTROY) { PostNcDestroy(); } return lr; }
// WM_SYSCOMMAND handler // We need to handle SC_MAXIMIZE to avoid any border leakage BOOL cef_dark_aero_window::HandleSysCommand(UINT command) { if ((command & 0xFFF0) != SC_MAXIMIZE) return FALSE; // Aero windows still get a border when maximized // The border, however, is the size of the unmaximized // window. To obviate that border we turn off drawing and // set the size of the window to zero then maximize the window // and redraw the window. // // This creates a new problem: the restored window size is now // 0 which, when actually restored, is the size returned from // the WM_GETMINMAXINFO handler. To obviate that problem we get // the window's restore size before maximizing it and reset it after. WINDOWPLACEMENT wp; ::ZeroMemory(&wp, sizeof (wp)); wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(&wp); SetRedraw(FALSE); SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE); DefaultWindowProc(WM_SYSCOMMAND, command, 0L); SetRedraw(TRUE); UpdateMenuBar(); wp.flags = 0; wp.showCmd = SW_MAXIMIZE; wp.ptMinPosition.x = -1; wp.ptMinPosition.y = -1; wp.ptMaxPosition.x = -1; wp.ptMaxPosition.y = -1; // reset the restore size SetWindowPlacement(&wp); return TRUE; }
static int InitDialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: RECT rc; GetWindowRect ((HWND)(lParam), &rc); MoveWindow (hDlg , (rc.right-rc.left)/2-160 , (rc.bottom-rc.top)/2-60 , 320 , 120 , TRUE); init_parameter_for_find(hDlg); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_TEXT), text_string_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_CASE), case_sensitive_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_WRAP), wrap_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_ALL), mark_all_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_UP), forward_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_FIND_DOWN), forward_notif_proc); return 1; case MSG_COMMAND: switch (wParam) { case IDC_FIND_NEXT: { HWND mdolphin_chwnd = get_current_mdolphin_hwnd(); if (mdolphin_chwnd) search_for(mdolphin_chwnd); } break; } break; case MSG_DESTROY: DestroyAllControls(hDlg); return 0; case MSG_CLOSE: { canCreateFindWindow = TRUE; SetWindowText (status_hwnd, ""); SendMessage(propsheet_hwnd, PSM_SHEETCMD, USER_PMS_CLOSE_SEARCHFOR, 0); DestroyMainWindowIndirect(hDlg); } return 0; } return DefaultWindowProc (hDlg, message, wParam, lParam); }
int PlayBackProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { PlayBack *playBack = (PlayBack*)GetWindowAdditionalData(hWnd); switch(message) { case MSG_CREATE: db_msg("PlayBackProc: --------MSG_CREATE\n"); if(playBack->createSubWidgets(hWnd) < 0) { db_error("create subWidgets failed\n"); break; } break; case MSG_CDR_KEY: return playBack->keyProc(wParam, lParam); case MSG_PREPARE_PLAYBACK: { std::string* file; file = (std::string*)wParam; db_msg("file is %s\n", file->c_str()); playBack->mCurId = (int)lParam; return playBack->PreparePlayBack(*file); } break; case MWM_CHANGE_FROM_WINDOW: { std::string file = "/mnt/extsd/out.mp4"; db_msg("MWM_CHANGE_FROM_WINDOW:---------------\n"); //playBack->prepareCamera4Playback(); /* 画面显示出来前clean layer */ // playBack->startPlayBack(); playBack->PreparePlayBack(file); db_msg("xxxxxx\n"); usleep(200 * 1000); /* 延时, 保证在layer被渲染后绘制窗口, 避免闪屏 */ set_ui_alpha(150); db_msg("xxxxxx\n"); } break; case MSG_TIMER: if(wParam == PLAYBACK_TIMER) { #ifdef PLAY_LOOP playBack->sendToPBP(0); #endif playBack->updateProgressBar(); } break; case MSG_PLB_COMPLETE: db_msg("MSG_PLB_COMPLETE: wParam is %d\n", wParam); playBack->sendToPBP(playBack->mCurId); #if 0 playBack->mCurrentState = STATE_PLAYBACK_COMPLETED; if(IsTimerInstalled(hWnd, PLAYBACK_TIMER) == TRUE) KillTimer(hWnd, PLAYBACK_TIMER); set_ui_alpha(255); if (wParam == 1) { playBack->reset(); /* if wParam is 1, the MSG_PLB_COMPLETE is send from the onCompletion, so playBack->stop is not need */ //SendMessage(GetParent(hWnd), MWM_CHANGE_WINDOW, WINDOWID_PLAYBACK, WINDOWID_PLAYBACKPREVIEW); #ifndef PLAY_LOOP playBack->sendToPBP(playBack->mCurId); #endif playBack->noWork(true); } else { /* if wParam is 0, the MSG_PLB_COMPLETE is send from outside, the caller expected to stop the playback, so need to call playBack->stop */ playBack->mStopFlag = 1; /* set the flag, tell the onCompletion not send the MSG_PLB_COMPLETE msg */ playBack->stop(); playBack->reset(); } #endif break; case MSG_SET_VOLUME: playBack->setPlayerVol(wParam); break; case MSG_SHOWWINDOW: if(wParam != SW_SHOWNORMAL) { playBack->releaseResource(); } break; } return DefaultWindowProc(hWnd, message, wParam, lParam); }
LRESULT CALLBACK GDisplay::WindowProc(UINT Msg, WPARAM wParam, LPARAM lParam) { return DefaultWindowProc(Msg, wParam, lParam); }