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

ALT-TAB

Started by n0p3x Aug 25, 2000 at 11:47 AM 4 replies 700+ views
Original Post
n0p3x
n0p3x
Just wondering, but how do know what someone presses ALT-TAB while running my program, cos I need to restore all my surfaces afterwards. I''m sure it sends a message but i''m not sure which message. Thanks. Regards, David Stubbs
Regards,Dave
Tornado
Tornado
The message is WM_ACTIVATE:

    
case WM_ACTIVATE:
{
if (LOWORD(wParam) == WA_INACTIVE))
// Focus was lost

else if ((LOWORD(wParam) == WA_ACTIVE) || (LOWORD(wParam) == WA_CLICKACTIVE))
// Focus was gained


} break;


Pretty sure that''s how it goes.



The road to success is always under construction
Goblineye EntertainmentThe road to success is always under construction
n0p3x
n0p3x
Cheers.

Regards,
David Stubbs
Regards,Dave
cyberben
cyberben
Are you sure? I thought:
    
case WM_SIZE:
{
if (wParam == SIZE_MINIMIZED)
//We were minimized

else if (wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)
//We are back up again

}


This is what I've seen. But If I remember correctly there are many ways of doing it, but the biggest mistake everyone makes is that at the beggining of your program/game when it's just first loading, they load there graphics, but they also get the SIZE_RESTORED message when it run, so they re-load and restore all the surfaces... so you have to do some smart thinking so that you don't do the same thing twice at the beggining of your game.

Another thing is set the display mode back while they are away from your game then set up again for your game. Many people get really anoyed when it messes there resolution and stuff..

Good luck!
See ya,
Ben

EDIT: Source didn't show properly.

Edited by - cyberben on August 25, 2000 2:27:29 PM
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
Priesty
Priesty
I had a great trouble about it. When you recieve WM_ACTIVATE check

BOOL bMinimized = HIWORD(wParam);

bMinimized tells if the window is minimized right now (before th e Windows will try to change it''s state). AND ONLY RELEASE YOUR STUFF IF bMinimized == false. AND RELOAD EVERYTHING ONLY IF bMinimized == true.

Do not forget about it.



------------------------------
DISCLAIMER: Im not responsible for any harm that my english can cause to your eyes, brains or programming skills.

------------------------------DISCLAIMER: Im not responsible for any harm that my english can cause to your eyes, brains or programming skills.

Topic Locked

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

Sign in to reply to this topic.