Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Gf11speed

Restoring Full Screen DirectX App.

This topic is 6119 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

With my game, for some reason, when I hit ALT-TAB and flip out of the game, and try to get back in it, it won''t let me. For some reason the game won''t come back on once its been downsized. How can I get the game to resume where it left off if I downsize it? Thanks!!! ---------- www.syntasoft.com ------------------

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
i am taiwanese, so my english no good, i use DirectX 7
------------------------------------------------------
hook WM_ACTIVATE message

case WM_ACTIVATE:
if(LOWORD(wParam) == WA_INACTIVE || (BOOL)HIWORD(wParam))
{
Pause(TRUE); /* pause */
}
else /*if(LOWORD(wParam) == WA_ACTIVE) ||
LOWORD(wParam) == WA_CLICKACTIVE))*/
{
Pause(FALSE); /* no pause */
}
------------------------------------------------------
no hook WM_SIZE message
------------------------------------------------------
this is Microsoft examples Flip,i modify it,

Flip:
/* get client rect */
if(m_bFullScreen)
{
GetWindowRect(m_hwndOwner, &rcDest);
}
else
{
GetClientRect(m_hwndOwner, &rcDest);
ClientToScreen(m_hwndOwner, (LPPOINT)&rcDest);
ClientToScreen(m_hwndOwner, (LPPOINT)&rcDest+1);
}

/* check lost surface */
if(m_pPrimaryBuffer->IsLost() == DDERR_SURFACELOST)
{
hr = m_pPrimarySurface->Restore();
if(hr == DDERR_WRONGMODE)
{
Free(); /* My Free DirectDraw */
return Create(); /* My Create DirectDraw */
}
if( FAILED(hr) ) return E_FAIL;

if(m_pBackBuffer->IsLost() == DDERR_SURFACELOST)
{
hr = m_pBackBuffer->Restore();
if( FAILED(hr) ) return E_FAIL;
}
}

/* flip */
if(m_bFullScreen)
{
while(TRUE)
{
hr = m_pPrimaryBuffer->Flip(NULL, DDFLIP_WAIT);
if(hr == DD_OK) break;
if(hr == DDERR_SURFACELOST)
{
hr = m_pPrimaryBuffer->Restore();
if( FAILED(hr) ) break;
}
if(hr != DDERR_WASSTILLDRAWING) break;
}
}
else
{
while(TRUE)
{
hr = m_pPrimaryBuffer->Blt(&rcDest, m_pBackSurface, NULL, DDBLT_WAIT, NULL);
if(hr == DD_OK) break;
if(hr == DDERR_SURFACELOST)
{
hr = m_pPrimaryBuffer->Restore();
if( FAILED(hr) ) break;
}
if(hr != DDERR_WASSTILLDRAWING) break;
}
}
------------------------------------------------------
good luck.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!