Alt-Tabability

Started by
1 comment, last by LackOfKnack 24 years, 4 months ago
In a nutshell... when you gain or lose focus (WM_ACTIVATE), you release / recreate the DirectDraw interface and all the surfaces.

Mason McCuskey
Spin Studios
www.spin-studios.com

[This message has been edited by mason (edited December 09, 1999).]

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Advertisement
Here's a newbie question for ya:

How do you make your DirectX app alt-tabable? Can you explain how to do it in VB or at least the general concept?

Thanks.

------------------

Lack

Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
In a typical C game, people usually have a BOOLean that is TRUE when the game is in the foreground, and FALSE otherwise. So in a typical loop it may look like:

while (TRUE)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if (bActive) // <--------
{
UpdateFrame;
}


Where to set the flag? Windows sends a WM_ACTIVATE message when your program is activated or deactivated...set the flag there.

case WM_ACTIVATE:
bActive = !((BOOL)HIWORD(wParam));
return 0L;

Teej

This topic is closed to new replies.

Advertisement