win32: how avoid flickers?

Apr 19, 2015 at 1:10pm
i continue with several problems with flickers :(
i know that i must use WS_CLIPCHILDREN parent style. and Regions, with child controls, for get transparency. but i continue with several problems with flickers :(
can i avoid the WS_CLIPCHILDREN and do a diferent thing?
i have read about the window Double Buffer(i mean for windows and not graphics), but i don't know how use it
Apr 20, 2015 at 9:51am
What controls are flickering? I believe there a few that support the WS_EX_DOUBLEBUFFERED extended style.

Do you create your window with CS_HREDRAW and CS_VREDRAW class styles?
Apr 20, 2015 at 8:22pm
have you sure?
https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx
i don't use class styles

how can i create my own window(s) Double Buffer?
Last edited on Apr 20, 2015 at 8:24pm
Apr 21, 2015 at 1:57am
Sorry my mistake. They're control-specific styles. For example tree-view and list-view controls have TVS_EX_DOUBLEBUFFER and LVS_EX_DOUBLEBUFFER. Maybe some other controls have it too.
Apr 21, 2015 at 9:58am
Forgot to mention that these flags require the common control library 6.0 or later. See this page:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb773175%28v=vs.85%29.aspx

If you use visual studio you can simply add this line to your source:

1
2
3
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 
Apr 21, 2015 at 11:32am
you can add:
1
2
case WM_ERASEBKGND:
    return 1;

to your main window procedure.
Apr 21, 2015 at 8:10pm
tath: i use it(TRUE instead 1) ;)
ahcfan: i use Code Blocks ;)

how can i do windows Double Buffer?(i mean windows controls and not the graphics)
Apr 23, 2015 at 10:41am
I'm still curious what controls are flickering, and if it happens only when you resize the window, and if and how you are updating those controls when the window resizes.

If you don't use Visual Studio you can still enable visual styles by adding something to your application manifest(see the link I posted). This will allow you to use the doublebuffer extended flags for controls that support it.

In my experience simple controls like buttons and edit controls never flicker, but controls with list contents like list-view and tree-view do and those are the ones that support the double buffer style flag.
Apr 23, 2015 at 7:56pm
i'm using a timer for animation with a button, using the WM_PAINT. so i must do:
1
2
case WM_ERASEBKGND:
    return TRUE;

but isn't good, so i must use WS_CLIPCHILDREN parent style and, of course, i use the Double Buffer for draw things.
but if i don't use the WS_CLIPCHILDREN style, i continue with flickers.
Topic archived. No new replies allowed.