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

OpenGL + ALT-TAB

Started by steviedisco Nov 23, 2010 at 12:02 PM 4 replies 2.8k views
Original Post
steviedisco
steviedisco
Hi,

I'm writing a dual-API rendering engine and have come to the point of elegantly handling the ALT-TAB issue.

I have done this successfully with DirectX, but when I try it with OpenGL I get some weird behaviour. The application continues to run, but the windows taskbar appears down the bottom of the screen in the resolution that the OpenGL app is running in over the top of the application.

I can ALT-TAB back to the app OK.

I am using a modified version of the NeHe OpenGL tutorial source.

My hunts around the web have been inconclusive, with mentions that it is driver and hardware-dependant. I am using an ATI-4870x2.

Any tips from you OpenGL gurus? :)
szecs
szecs
Well, what behaviour do you want? Do you want the window to be minimized but running? Minimized and paused? Or something else? Do you want to handle Alt-enter and alt-tab differently or in the same way?

What do you mean by "I have done this successfully with DirectX". How did it behave?
TTK-Bandit
TTK-Bandit
just a guess here, are you using vista or 7 ?
if so, disable aero and try again.
steviedisco
steviedisco
I'm using Windows 7 64-bit.

Sorry for not explaining correctly, but the behaviour I would expect is for the display to return to the user's desktop, with the application paused and minimised in the taskbar, ready to be returned to by clicking the application's taskbar icon.

I got this working in DirectX - it wasn't straightforward, as I had to deal with a lost device and recreate my assets upon re-entry. But I found some decent source code and went from there.

I hadn't thought about Alt-Enter. I'll look into how it operates with Aero disabled.

Thanks
szecs
szecs
I use this:
case WM_ACTIVATE:		{	int _active,_minimized;			_active = LOWORD(wParam);			_minimized = (BOOL) HIWORD(wParam);						if (_active && !_minimized)			{	win_state.Active = true;				SetForegroundWindow( hWnd );				ShowWindow(hWnd, SW_RESTORE );				ChangeDisplaySettings(&dmScreenSettings[CurrentDisplayMode],										CDS_FULLSCREEN);			}			else			{	win_state.Active = false;				ShowWindow(hWnd,SW_MINIMIZE);				ChangeDisplaySettings(&dmDesktopSettings,CDS_FULLSCREEN);			}		}		return DefWindowProc(hWnd,uMsg,wParam,lParam);
steviedisco
steviedisco
Ah, you're a genius! That works perfectly.

I doff my cap to you sir.

Topic Locked

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

Sign in to reply to this topic.