BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam) { // Switch by id to resize tool windows. This function to get the // tool id doesn't work according to the documentation, but is the // only way to do this that I have found switch ((DWORD)GetMenu(hWnd)) { // Toolbar, let it resize itself case TOOLBAR_ID: SendMessage(hWnd, WM_SIZE, 0, lParam); GetWindowRect(hWnd, &toolbar.rect); MapWindowPoints(NULL, (HWND)lParam, (POINT *)&toolbar.rect, 2); break; // Status bar, let it resize itself case STATUS_ID: SendMessage(hWnd, WM_SIZE, 0, lParam); GetWindowRect(hWnd, &status.rect); MapWindowPoints(NULL, (HWND)lParam, (POINT *)&status.rect, 2); break; // X scale, resize it case XSCALE_ID: MoveWindow(hWnd, status.rect.left, status.rect.top - SCALE_HEIGHT, status.rect.right, SCALE_HEIGHT, FALSE); InvalidateRgn(hWnd, NULL, TRUE); GetWindowRect(hWnd, &xscale.rect); MapWindowPoints(NULL, (HWND)lParam, (POINT *)&xscale.rect, 2); break; // Y scale, resize it case YSCALE_ID: MoveWindow(hWnd, toolbar.rect.left, toolbar.rect.bottom, SCALE_WIDTH, xscale.rect.top - toolbar.rect.bottom, FALSE); InvalidateRgn(hWnd, NULL, TRUE); GetWindowRect(hWnd, &yscale.rect); MapWindowPoints(NULL, (HWND)lParam, (POINT *)&yscale.rect, 2); break; // Scope, resize it case SCOPE_ID: MoveWindow(hWnd, yscale.rect.right, toolbar.rect.bottom, toolbar.rect.right - yscale.rect.right, xscale.rect.top - toolbar.rect.bottom, FALSE); InvalidateRgn(hWnd, NULL, TRUE); break; } return TRUE; }
void UpdateFrequency() { static double fps = (double)SAMPLE_RATE / (double)STEP; // Update frequency double frequency = pow(10.0, (double)scale.v / (double)FREQ_SCALE) * 10.0; display.f = frequency; spectrum.f = frequency / fps; InvalidateRgn(display.hwnd, NULL, TRUE); InvalidateRgn(scale.hwnd, NULL, TRUE); }
INT_PTR CALLBACK filterTriProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_AM,n_filter_signal_am,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_FREQ,n_filter_signal_freq,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_AM,n_filter_carrier_am,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_FREQ,n_filter_carrier_freq,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_AM,NULL,TRUE), 0,5,n_filter_signal_am,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_FREQ,NULL,TRUE), 1,500,n_filter_signal_freq,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_AM,NULL,TRUE), 0,5,n_filter_carrier_am,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_FREQ,NULL,TRUE), 0,1000,n_filter_carrier_freq,Translated); if(!Translated) return FALSE; n_mCoordMode=FILTER_TRI; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
INT_PTR CALLBACK DftParaProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_DFT_POINT,m_dft_point,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_AMPLITUDE,m_tri_amplitude,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_PIEROD,m_tri_pierod,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_COUNT,m_tri_count,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_DFT_POINT,NULL,TRUE), 1,160,m_dft_point,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_AMPLITUDE,NULL,TRUE), 1,5,m_tri_amplitude,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_PIEROD,NULL,TRUE), 1,160,m_tri_pierod,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_COUNT,NULL,TRUE), 1,5,m_tri_count,Translated); if(!Translated) return FALSE; n_mCoordMode=DFT_TRI; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
LRESULT CVideoMarkup::OnLoadFilter( UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bool isAlreadyLoaded = (classifier == (Classifier*)lParam); m_filterSelect.SelectFilter(wParam); recognizerMode = wParam; switch(wParam) { case COLOR_FILTER: ReplaceClassifier((ColorClassifier*)lParam); break; case SHAPE_FILTER: ReplaceClassifier((ShapeClassifier*)lParam); break; case SIFT_FILTER: ReplaceClassifier((SiftClassifier*)lParam); break; case BRIGHTNESS_FILTER: ReplaceClassifier((BrightnessClassifier*)lParam); break; case ADABOOST_FILTER: ReplaceClassifier((HaarClassifier*)lParam); break; case MOTION_FILTER: ReplaceClassifier((MotionClassifier*)lParam); break; case GESTURE_FILTER: ReplaceClassifier((GestureClassifier*)lParam); break; } InvalidateRgn(activeRgn, FALSE); return isAlreadyLoaded; }
void Refresh(){ static Point cptOld; HDC hdc, hMemDC; HBITMAP hOldBit; hdc = GetDC(hWndMain); if(cpt != cptOld) { DeleteObject(hBit); hBit = CreateCompatibleBitmap(hdc, cpt.X, cpt.Y); cptOld = cpt; } hMemDC = CreateCompatibleDC(hdc); hOldBit = (HBITMAP)SelectObject(hMemDC, hBit); //draw begin POINT pt; GetCursorPos(&pt); ScreenToClient(hWndMain, &pt); Point pm(pt.x, pt.y), p; p = A2L(pm + Point(ppp / 2, -ppp / 2)); board->draw(hMemDC, p); //draw end SelectObject(hMemDC, hOldBit); DeleteDC(hMemDC); ReleaseDC(hWndMain, hdc); InvalidateRgn(hWndMain, NULL, FALSE); }
void MCStack::updatewindow(MCRegionRef p_region) { if (m_window_shape == nil || m_window_shape -> is_sharp) { InvalidateRgn((HWND)window -> handle . window, (HRGN)p_region, FALSE); UpdateWindow((HWND)window -> handle . window); } else { if (m_window_shape -> handle == nil) m_window_shape -> handle = MCscreen -> createpixmap(m_window_shape -> width, m_window_shape -> height, 0, False); Pixmap t_pixmap; t_pixmap = (Pixmap)m_window_shape -> handle; if (t_pixmap == nil) return; if (s_update_pixmap == nil) { MCWindowsLayeredStackSurface t_surface(t_pixmap, m_window_shape); redrawwindow(&t_surface, (MCRegionRef)p_region); } else MCscreen -> copyarea(s_update_pixmap, t_pixmap, 32, 0, 0, s_update_rect . width, s_update_rect . height, s_update_rect . x, s_update_rect . y, GXcopy); composite(); } }
INT_PTR CALLBACK inputParaProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_INPUTPARA_PERIOD,m_Period,TRUE); SetDlgItemInt(hwndDlg,IDC_INPUTPARA_AMPLITUDE,m_Amplitude,TRUE); SetDlgItemInt(hwndDlg,IDC_INPUTPARA_SAMPFREQ,m_SampleFreq,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_PERIOD,NULL,TRUE), 4,320,m_Period,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_AMPLITUDE,NULL,TRUE), 1,5,m_Amplitude,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_SAMPFREQ,NULL,TRUE), 1,159,m_SampleFreq,Translated); if(!Translated) return FALSE; n_mCoordMode=SINSIGNAL_INPUT; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
void Refresh() { if (!IsIconic(hMainWnd)) { /* Invalidate the client area forcing a WM_PAINT message */ InvalidateRgn(hMainWnd, NULL, TRUE); } }
void MCStack::device_updatewindow(MCRegionRef p_region) { if (m_window_shape == nil || m_window_shape -> is_sharp) { InvalidateRgn((HWND)window -> handle . window, (HRGN)p_region, FALSE); UpdateWindow((HWND)window -> handle . window); } else { MCRectangle t_device_rect; t_device_rect = MCGRectangleGetIntegerBounds(MCResUserToDeviceRect(MCRectangleMake(0, 0, m_window_shape->width, m_window_shape->height))); HBITMAP t_bitmap = nil; void *t_bits = nil; if (m_window_shape -> handle == nil) { if (!create_temporary_dib(((MCScreenDC*)MCscreen)->getdsthdc(), t_device_rect.width, t_device_rect.height, t_bitmap, t_bits)) return; m_window_shape -> handle = t_bitmap; } else { t_bitmap = (HBITMAP)m_window_shape -> handle; BITMAP t_bitmap_struct; GetObjectA(t_bitmap, sizeof(BITMAP), &t_bitmap_struct); t_bits = t_bitmap_struct.bmBits; } MCGRaster t_raster; t_raster.width = t_device_rect.width; t_raster.height = t_device_rect.height; t_raster.pixels = t_bits; t_raster.stride = t_raster.width * sizeof(uint32_t); t_raster.format = kMCGRasterFormat_ARGB; MCGRaster t_mask; /* UNCHECKED */ MCWin32GetWindowShapeAlphaMask(m_window_shape, t_mask); MCWindowsLayeredStackSurface t_surface(t_raster, &t_mask); if (t_surface.Lock()) { if (s_update_callback == nil) device_redrawwindow(&t_surface, (MCRegionRef)p_region); else s_update_callback(&t_surface, (MCRegionRef)p_region, s_update_context); t_surface.Unlock(); composite(); } } }
// // window procedure // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HANDLE hThread[NUM_OF_THREADS] ; static ThreadArgument arg[NUM_OF_THREADS] ; static DWORD threadID ; int wmId, wmEvent ; unsigned int loop ; switch( message ) { case WM_CREATE: mutex = CreateMutex( 0, FALSE, 0 ) ; break ; case WM_COMMAND: // user menu wmId = LOWORD( wParam ) ; wmEvent = HIWORD( wParam ) ; switch( wmId ) { case IDM_TEST: sX = 0 ; for( loop = 0 ; loop < NUM_OF_THREADS ; loop++ ) { arg[loop].hWnd = hWnd; arg[loop].NO = loop; hThread[loop] = CreateThread( 0, 0, // create a thread (LPTHREAD_START_ROUTINE)drawThread, (VOID *)&(arg[loop]), 0, &threadID ) ; } while( WaitForMultipleObjects( NUM_OF_THREADS, hThread, TRUE, 0) == WAIT_TIMEOUT ) Sleep( 10 ) ; break; case IDM_CLEAR: InvalidateRgn( hWnd, NULL, TRUE ) ; break ; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc( hWnd, message, wParam, lParam ) ; } break ; case WM_DESTROY: CloseHandle( mutex ) ; PostQuitMessage(0); break; default: return DefWindowProc( hWnd, message, wParam, lParam ) ; } return 0 ; }
void wButtonSetBusy( wButton_p b, int value ) { b->busy = value; if (!value) b->selected = FALSE; /*SendMessage( b->hWnd, BM_SETSTATE, (WPARAM)value, 0L );*/ InvalidateRgn( b->hWnd, NULL, FALSE ); }
static void mi_scroll(int dx, int dy) { HRGN rgn; rgn = CreateRectRgn(0, 0, 0, 0); ScrollWindowEx(g_Wnd, dx, dy, 0, 0, rgn, 0, SW_ERASE); InvalidateRgn(g_Wnd, rgn, 0); DeleteObject(rgn); }
// The wParam stores the new threshold value (from 0 to 100) and the lParam // indicates whether or not the slider is currently being dragged LRESULT CVideoMarkup::OnSetThreshold(UINT, WPARAM wParam, LPARAM lParam, BOOL& ) { if ((wParam < 0) || (wParam > 100)) return 0; float newThresh = ((float)wParam) / 100.0; classifier->threshold = newThresh; if (showGuesses && !lParam) { RunClassifierOnCurrentFrame(); InvalidateRgn(activeRgn, FALSE); } return 0; }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; switch (message) { case WM_TIMER: InvalidateRgn(hWnd, 0, 1); RedrawWindow(hWnd, 0, 0, 0);// RDW_ERASE); break; case WM_PAINT:{ HDC hdc; hdc = BeginPaint(hWnd, &ps); mainloop(hdc); EndPaint(hWnd, &ps); } break; case WM_MOUSEMOVE: { for (auto it : Circle::objectStorage) { if (dynamic_cast<UserRobot*>(it) != nullptr) { it->moveToPoint(LOWORD(lParam), HIWORD(lParam)); } } break; } case WM_LBUTTONDOWN: { for (auto it : Circle::objectStorage) { UserRobot * player = dynamic_cast<UserRobot*>(it); if (player != nullptr) { Circle::objectStorage.push_back(new Bolt(it->x, it->y, (double)LOWORD(lParam), (double)HIWORD(lParam), 10, player)); it->energy -= 10; } } break; } case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled) { int i; infoPtr->Enabled = enabled; for (i = 0; i < 4; i++) EnableWindow(infoPtr->Part[i].EditHwnd, enabled); InvalidateRgn(infoPtr->Self, NULL, FALSE); return 0; }
LRESULT AeroControlBase::ProgressbarWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_ENABLE: case WM_STYLECHANGED: { LRESULT res = DefSubclassProc(hWnd, uMsg, wParam, lParam); InvalidateRgn(hWnd, NULL, FALSE); return res; } break; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); RECT rc; GetWindowRect(hWnd, &rc); MapWindowPoints(NULL, hWnd, (LPPOINT)&rc, 2); if (hdc) { PaintControl(hWnd, hdc, &ps.rcPaint, false); BP_PAINTPARAMS params = { sizeof(BP_PAINTPARAMS) }; params.dwFlags = 0L; HDC hdcPaint = NULL; HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hdc, &rc, BPBF_TOPDOWNDIB, ¶ms, &hdcPaint); if (hdcPaint) { COLORREF cr = RGB(0x00, 0x00, 0x00); SetPixel(hdcPaint, 0, 0, cr); SetPixel(hdcPaint, 0, RECTHEIGHT(rc) - 1, cr); SetPixel(hdcPaint, RECTWIDTH(rc) - 1, 0, cr); SetPixel(hdcPaint, RECTWIDTH(rc) - 1, RECTHEIGHT(rc) - 1, cr); EndBufferedPaint(hBufferedPaint, TRUE); } } EndPaint(hWnd, &ps); return 0; } break; case WM_NCDESTROY: case WM_DESTROY: RemoveWindowSubclass(hWnd, SubclassProc, Static); subclassedControls.erase(hWnd); break; } return DefSubclassProc(hWnd, uMsg, wParam, lParam); }
void wButtonSetLabel( wButton_p b, const char * label ) { if ((b->option&BO_ICON) == 0) { /*b->labelStr = label;*/ SetWindowText( b->hWnd, label ); } else { b->icon = (wIcon_p)label; } InvalidateRgn( b->hWnd, NULL, FALSE ); }
void UpdateValues() { // Update frequency int value = SendMessage(fine.hwnd, TBM_GETPOS, 0, 0); double fine = -(double)(value - FINE_REF) / 10000.0; double frequency = pow(10.0, (double)scale.value / FREQ_SCALE) * 10.0; display.frequency = frequency + (frequency * fine); // Update level value = SendMessage(level.hwnd, TBM_GETPOS, 0, 0); audio.level = MAX_LEVEL * (LEVEL_MAX - value) / LEVEL_MAX; display.decibels = log10((double)(LEVEL_MAX - value) / 200.0) * 20.0; if (display.decibels < -80.0) display.decibels = -80.0; InvalidateRgn(display.hwnd, NULL, TRUE); InvalidateRgn(scale.hwnd, NULL, TRUE); }
// // WM_TIMER handler // // Used to handle mouse-scrolling // LRESULT GridView::OnTimer(UINT_PTR nTimer) { RECT rect; POINT pt; int dx = 0, dy = 0; // get the current client-rectangle GetActiveClientRect(&rect); // get the mouse's client-coordinates GetCursorPos(&pt); ScreenToClient(m_hWnd, &pt); // // scrolling up/down? // if(pt.y < rect.top) dy = ScrollDir(m_nScrollCounter, pt.y - rect.top); else if(pt.y >= rect.bottom) dy = ScrollDir(m_nScrollCounter, pt.y - rect.bottom); // // scrolling left / right? // if(pt.x < rect.left) dx = ScrollDir(m_nScrollCounter, pt.x - rect.left); else if(pt.x > rect.right) dx = ScrollDir(m_nScrollCounter, pt.x - rect.right); HRGN hrgnUpdate = ScrollRgn(dx * 10, dy, true); if(hrgnUpdate != NULL) { OnMouseMove(pt.x, pt.y); InvalidateRgn(m_hWnd, hrgnUpdate, FALSE); DeleteObject(hrgnUpdate); UpdateWindow(m_hWnd); } m_nScrollCounter++; return 0; }
void CPianoCtrl::SetPressed(int KeyIdx, bool Enable, bool External) { CKey& key = m_Key[KeyIdx]; if (Enable == key.m_IsPressed) // if key already in requested state return; // nothing to do DWORD dwStyle = GetStyle(); if (dwStyle & PS_HIGHLIGHT_PRESS) // if indicating pressed keys InvalidateRgn(&key.m_Rgn); // mark key for repainting key.m_IsPressed = Enable; key.m_IsExternal = External; if (!External) { // if key pressed by us CWnd *pParentWnd = GetParent(); // notify parent window ASSERT(pParentWnd != NULL); pParentWnd->SendMessage(UWM_PIANOKEYCHANGE, KeyIdx, LPARAM(m_hWnd)); } }
// Invalidates the tab's region in the client area. void Invalidate(int index) { if (index < 0) return; Graphics graphics(hwnd); GraphicsPath shapes(data->Points, data->Types, data->Count); GraphicsPath shape; GraphicsPathIterator iterator(&shapes); iterator.NextMarker(&shape); Region region(&shape); ClientRect rClient(hwnd); REAL yPosTab = inTitlebar ? 0.0f : REAL(rClient.dy - height - 1); graphics.TranslateTransform(REAL((width + 1) * index) + 1.0f, yPosTab); HRGN hRgn = region.GetHRGN(&graphics); InvalidateRgn(hwnd, hRgn, FALSE); DeleteObject(hRgn); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; switch (message) { case WM_TIMER: InvalidateRgn(hWnd, 0, 1); RedrawWindow(hWnd, 0, 0, 0);// RDW_ERASE; break; case WM_PAINT: HDC hdc; hdc = BeginPaint(hWnd, &ps); mainloop(hdc); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_MOUSEMOVE: for (auto c : Circle::objectStorage) { InterfaceRobort* r = dynamic_cast<InterfaceRobort*>(c); if (r != nullptr) { r->moveToPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } } break; case WM_LBUTTONDOWN: for (auto c : Circle::objectStorage) { InterfaceRobort* r = dynamic_cast<InterfaceRobort*>(c); if (r != nullptr) { r->moveToPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); Circle::objectStorage.push_back(new Bolt(r->x, r->y, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 10, r)); } } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
//------------------------------------------------------------------------- // redraw window //------------------------------------------------------------------------- void GWinControl::Refresh() { if ( m_Hwnd) { // invalidate whole window for redrawing if ( InvalidateRgn( m_Hwnd, NULL, TRUE ) ) { UpdateWindow( m_Hwnd ); } else { GDebug::CheckWin32Error(); } } // refresh is manually called, so update scrollbars UpdateScrollBars(); }
void CSpiroView::OnRemovePiece(CBasePiece** ppPiece) { ENSURE(ppPiece != NULL && *ppPiece != NULL); CRgn rgnPiece; CDC* pDC = GetDC(); ENSURE(pDC != NULL); OnPrepareDC(pDC); (*ppPiece)->GetDevPieceRgn(pDC, &rgnPiece, m_nZoomNumer, m_nZoomDenom, true); InvalidateRgn(&rgnPiece); delete *ppPiece; *ppPiece = NULL; ReleaseDC(pDC); GetDocument()->TransferCurrentFigure(); // make the current figure permanent m_bDrawingDone = false; }
//重画窗口 void CCatchScreenDlg::PaintWindow() { //获取当全屏对话框窗口大小 CRect rect1; GetWindowRect(rect1); //获取编辑框窗口大小 CRect rect2; m_tipEdit.GetWindowRect(rect2); CRgn rgn1,rgn2; rgn1.CreateRectRgnIndirect(rect1); rgn2.CreateRectRgnIndirect(rect2); //获取更新区域,就是除了编辑框窗口不更新 m_rgn.CombineRgn(&rgn1,&rgn2,RGN_DIFF); InvalidateRgn(&m_rgn); }
LRESULT CVideoMarkup::OnTrack( UINT, WPARAM wParam, LPARAM, BOOL& ) { long sliderPosition = (long) ::SendDlgItemMessage(m_videoControl, IDC_VIDEOSLIDER, TBM_GETPOS, 0, 0); selectingRegion = false; if (LOWORD(wParam) == SB_ENDSCROLL) { scrubbingVideo = false; } else { scrubbingVideo = true; } selectStart.X = 0; selectStart.Y = 0; selectCurrent = selectStart; m_videoLoader.LoadFrame(sliderPosition); if (showGuesses && !scrubbingVideo) { RunClassifierOnCurrentFrame(); } InvalidateRgn(activeRgn, FALSE); return 0; }
//重画窗口 void CCatchScreenDlg::PaintWindow() { //获取当全屏对话框窗口大小 CRect rectWindow; GetWindowRect(rectWindow); //获取编辑框窗口大小 CRect rectEdit; m_wndTipEdit.GetWindowRect(rectEdit); CRgn rgnWindow, rgnEdit; rgnWindow.CreateRectRgnIndirect(rectWindow); rgnEdit.CreateRectRgnIndirect(rectEdit); //获取更新区域,就是除了编辑框窗口不更新 m_rgnUpdate.CombineRgn(&rgnWindow,&rgnEdit, RGN_DIFF); InvalidateRgn(&m_rgnUpdate); rgnWindow.DeleteObject(); rgnEdit.DeleteObject(); }
void CVideoMarkup::RecordVideoFile() { if (m_videoRecorder.RecordVideoFile(m_hWnd)) { // Video was successfully recorded, so we will load it now HCURSOR hOld = SetCursor(LoadCursor(0, IDC_WAIT)); m_videoLoader.OpenVideoFile(m_hWnd, m_videoRecorder.szFileName); if (m_videoLoader.videoLoaded) { EnableControls(TRUE); ::SendDlgItemMessage(m_videoControl, IDC_VIDEOSLIDER, TBM_SETRANGEMIN, FALSE, 0); ::SendDlgItemMessage(m_videoControl, IDC_VIDEOSLIDER, TBM_SETRANGEMAX, FALSE, m_videoLoader.nFrames-1); ::SendDlgItemMessage(m_videoControl, IDC_VIDEOSLIDER, TBM_SETPOS, TRUE, 0); m_videoLoader.LoadFrame(0); InvalidateRgn(activeRgn,FALSE); if (recognizerMode == GESTURE_FILTER) { // we're in "gesture" mode so we'll need to precompute the trajectories m_videoLoader.LearnTrajectories(); } } SetCursor(hOld); } }
LOCAL void fb_copyarea(WINDISPLAY *mod, struct TVRequest *req) { WINWINDOW *win = req->tvr_Op.CopyArea.Window; struct THook *exposehook = (struct THook *) TGetTag(req->tvr_Op.CopyArea.Tags, TVisual_ExposeHook, TNULL); TINT *sr = req->tvr_Op.CopyArea.Rect; TINT dx = req->tvr_Op.CopyArea.DestX - sr[0]; TINT dy = req->tvr_Op.CopyArea.DestY - sr[1]; RECT r; r.left = sr[4]; r.top = sr[5]; r.right = sr[4] + sr[2]; r.bottom = sr[5] + sr[3]; if (exposehook) { RGNDATAHEADER *rdh = (RGNDATAHEADER *) win->fbv_RegionData; RECT *rd = (RECT *) (rdh + 1); HRGN updateregion = CreateRectRgn(0, 0, 0, 0); ScrollDC(win->fbv_HDC, dx, dy, &r, &r, updateregion, NULL); if (GetRegionData(updateregion, 1024, (LPRGNDATA) rdh)) { TUINT i; for (i = 0; i < rdh->nCount; ++i) TCallHookPkt(exposehook, win, (TTAG) (rd + i)); } else { TDBPRINTF(TDB_WARN,("Regiondata buffer too small\n")); InvalidateRgn(win->fbv_HWnd, updateregion, FALSE); } DeleteObject(updateregion); } else ScrollDC(win->fbv_HDC, dx, dy, &r, &r, NULL, NULL); win->fbv_Dirty = TTRUE; }