Thread: Repaint

  1. #1
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Ontario, Canada


    I'm trying to have my program repaint in a loop, but it only waits until the loop is done to redraw. Here's my code:
    while( ftell( fIn ) < fileSize ) {
    	ZeroMemory( pszBuffer, 512 );
    	fread( pszBuffer, 512, sizeof( char ), fIn );
    	//do stuff
    	fwrite( pszBuffer, 512, sizeof( char ), fOut );
    	setProgress( progress + 512 );
    	RECT rect;
    	GetWindowRect(hWnd, &rect);
    	InvalidateRect(hWnd, &rect, true);
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  2. #2
    Registered User
    Join Date
    Apr 2002
    Basically you're posting a WM_PAINT message with InvalidateRect, however you are still doing stuff in a loop so the message isn't being processed. If this is in another thread then the code would probably work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Repaint window
    By Gordon in forum Windows Programming
    Replies: 3
    Last Post: 05-26-2008, 07:26 AM
  2. RePaint Problem
    By mrafcho001 in forum Windows Programming
    Replies: 6
    Last Post: 09-05-2005, 06:29 PM
  3. HELP! Window can't RePaint fast enough.
    By vulcan_146 in forum Windows Programming
    Replies: 2
    Last Post: 03-21-2004, 07:08 PM
  4. Repaint a window
    By Mithoric in forum Windows Programming
    Replies: 9
    Last Post: 12-21-2003, 09:12 PM
  5. How do I tell my window to repaint?
    By Marcos in forum Windows Programming
    Replies: 8
    Last Post: 07-27-2003, 04:30 PM