Skip to main content
GameDev.net gamedev.net
🔒 Locked

Minimizing FullScreen App

Started by zourtney Jan 23, 2003 at 3:06 AM 2 replies 200+ views
Original Post
zourtney
zourtney
I am trying to write a simple 2d wrapper for DirectX, to get acquinted with it. The problem comes when you try to minimize the application. It seems to just disappear. I don''t know if it terminated abnormally or what. It no longer is in the taskbar or running in the processes. Any ideas? I also want to make sure that the surfaces are saved when I minimize and a flag ("PAUSED" or something) is set. Help!! zourtney
IFooBar
IFooBar
Coulod be a problem with your message handler or maybe your not handling lost devices properly. What does your lost device and message handler code look like?


:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile
[size=2]aliak.net
Bullmax
Bullmax
You must Validate the Direct3D device before starting the rendering (Begin / End). I not sure of the right syntax, but it is something like that :


// D3D device initialized at startup //
LPDIRECT3DDEVICE8 pDevice;

// Parameters to used to create the D3D Device at startup //
D3DPRESENT_PARAMETERS objPresentParameters;

// Check for device availability //
HRESULT ValidateDevice( VOID )
{
HRESULT hResult;

hResult = pDevice->TestCooperativeLevel();
if (FAILED(hResult))
{
if (hResult == D3DERR_DEVICELOST)
return (E_FAIL);

if (hResult == D3DERR_DEVICENOTRESET)
{

//*** Release objects here ***//

if (FAILED(pDevice->Reset( &objPresentParameters )))
return (E_FAIL);

ClearScreen();

//*** Reload objects here ***//

}
}

return (S_OK);
}




/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.
/ Bullmax /-------------Reality has many forms : good and evil, black and white, yin and yang.
Bullmax
Bullmax
Then in your main loop, you would validate the device before rendering :


VOID MainLoop( VOID )
{
// ..... //

if (SUCCEEDED(ValidateDevice( VOID )))
{
if (SUCCEEDED(pDevice->Begin()))
{
ClearScreen();

//###[ RENDER EVERYTHING HERE ]###//

pDevice->End();
}
}

// ..... //
}




/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.
/ Bullmax /-------------Reality has many forms : good and evil, black and white, yin and yang.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.