we've all seen it,
you exit a fullscreen directx windows title, and the screen flashes some junk, just before the desktop appears. a final present or some such thing.
to avoid this, i display a "Closing Caveman..." message on a black screen, twice in a row (clear, render, and present twice) to make sure both buffers contain that screen.
seemed to work ok at first, but now i'm getting the last screenshot taken, or the last 3d scene rendered. it flashes just once, after confirming quit to desktop, and before the desktop appears.
these are the present parameters i'm using:
void Zsetparams(int w,int h)
{
ZeroMemory(&Zparams,sizeof(D3DPRESENT_PARAMETERS));
Zparams.AutoDepthStencilFormat = D3DFMT_D24X8;
Zparams.BackBufferCount=1;
Zparams.BackBufferFormat = D3DFMT_A8R8G8B8; // set the back buffer format to 32-bit // turn these on for fullscreen
Zparams.BackBufferWidth = (unsigned)w; //width; // set the width of the buffer
Zparams.BackBufferHeight = (unsigned)h; //height; // set the height of the buffer
Zparams.EnableAutoDepthStencil = TRUE; // automatically run the z-buffer for us
Zparams.Flags=0;
Zparams.FullScreen_RefreshRateInHz=D3DPRESENT_INTERVAL_DEFAULT;
Zparams.hDeviceWindow=Zprogram_window_handle;
Zparams.MultiSampleQuality=0;
Zparams.MultiSampleType=D3DMULTISAMPLE_NONE;
Zparams.PresentationInterval=D3DPRESENT_INTERVAL_DEFAULT;
Zparams.SwapEffect = D3DSWAPEFFECT_COPY; //D3DSWAPEFFECT_DISCARD;
Zparams.Windowed = FALSE; // TRUE for windowed, FALSE for fullscreen
}