OpenGL + ALT-TAB

Started by
4 comments, last by steviedisco 13 years, 5 months ago
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? :)
Advertisement
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?
just a guess here, are you using vista or 7 ?
if so, disable aero and try again.
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
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);
Ah, you're a genius! That works perfectly.

I doff my cap to you sir.

This topic is closed to new replies.

Advertisement