Is there any way to prevent the screen from flashing when swapbuffering

I am using double buffers. Each time when I call swapbuffers after I render, the screen flashes, which makes my eyes uncomfortable. Is there any solution to this problem.

I am using Visual C++6.0

Are you sure that you have setup doublebuffering correct ? because if you do there should be no flashing at all.

Have you tried turning vsync on?

I think I need to write my problem in detail. I call OpenGL functions including swapbuffers in OnDraw function of a window. And I popup a messagebox for the user to select something frequently. When the focus return to the window, the window’s OnDraw function is run automatially, and its screen flashes. That is the problem.
Who knows how to do?

Originally posted by Overmind:
Have you tried turning vsync on?
I turned it on. But it did not work.

Could be that the window is cleared with GDI during the WM_ERASEBKGND message.
Implement a handler for OnEraseBkgnd() which just returns non-zero.
That means it does no rendering and also does not route the message to the default window message handler which normally erases the background for you.
This should prevent GDI from clearing the window and only your OpenGL redraw should update it flicker free.

Relic, Thank you. It is done.