none
Window Graphics Update Focus/Scope RRS feed

  • Question

  • I am using C++ WM_PAINT called from main message loop with PeekMessage() to redraw a graphic on time based event trigger.  So far it seems to be working well with the exception of when I stall on a window redraw event (click and hold the window frame with the intent to drag or click to resize and hold).  The window portion that I would like to redraw doesn't get up dated in that case.  Wondering if someone has a solution to keep redraw events running in the background in these situations.
    while (TRUE)
    	{
    		while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
    		{
    			if (msg.message == WM_QUIT)
    				break;
    			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
    			{
    				TranslateMessage(&msg);
    				DispatchMessage(&msg);
    			}
    		}
    		
    		if (msg.message == WM_QUIT)
    			break;
    		//rest of non-message stuff	
    		checkForRedraw();
    		
    		if (refreshWindowTimer) {
    			sinecounter++;
    			calculateSine(sinecounter);
    			//ValidateRect(hWnd, NULL);
    			//InvalidateRect(hWnd, NULL, TRUE);
    			RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
    			refreshWindowTimer = FALSE;
    		}

    Friday, March 8, 2019 6:35 PM