Resizing window causes extreme flicker

This is a discussion on Resizing window causes extreme flicker within the Windows Programming forums, part of the Platform Specific Boards category; The code I have now functions fine, it's just that when the window resizes the scroll bar flickers horribly. The ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    36

    Resizing window causes extreme flicker

    The code I have now functions fine, it's just that when the window resizes the scroll bar flickers horribly. The image is fine, it's just the scroll bar. Shaft and all. These black rectangles flicker over the bar and arrows as I resize it.

    This is what happens when the parent window is resized. Theres a WM_SIZE sent to the status bar before this.

    Code:
    void SizeWindowStatus(void)
    {
    	RECT rctp;
    	RECT rctc;
    	RECT rcts;
    	int yNewHeight;
    	
    	GetClientRect(g_hWndP, &rctp);
    	GetClientRect(g_hWndC, &rctc);
    	GetClientRect(g_hStatus, &rcts);
    	
    	yNewHeight = rctp.bottom - rcts.bottom;
    	
    	MoveWindow(g_hWndC, 0, 0, rctp.right, yNewHeight, TRUE);
    	UpdateWindow(g_hWndC);
    	
    	return;
    }
    P is the parent, C is the child and S is the status. This bit sizes the child window as the parent window sizes so it fits against the status bar and new parent width, which it does fine. The scrollbar flicker is unbearable though and I don't have a clue what's causing it.

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    Why've you got UpdateWindow immediately after MoveWindow with bRepaint = TRUE?

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Try returning true to WM_ERASEBKGND msgs.

    UpdateWindow() posts a paint to the dialogs msg que, bypassing the OS que.

    Not sure if this works well with MoveWindow() but it should.....
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Also, make sure you are using the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles with the parent window.

  5. #5
    Registered User
    Join Date
    Jun 2006
    Posts
    36
    anonytmouse, that fixed it up perfectly. Not a speck of flickering. Thanks.

  6. #6
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186
    i'm new to windows programming, but the functions is "void", why you have "return" statement??
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  7. #7
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Quote Originally Posted by Hussain Hani View Post
    i'm new to windows programming, but the functions is "void", why you have "return" statement??
    it is absolutely legal to have a return statement with no return value in the void function...

    It is meaningless as a last statement in the function, but still it is legal
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 03:33 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21