This issue was covered in another post…but it was vague with details…so here you go. some psuedo code. Let me know if ya find something I missed.
//I started with the NEHEGL stuff tutorial "setting up an opengl window"
//
//http://nehe.gamedev.net/lesson.asp?index=01
//
//but it doesn't handle alt-tabbing proper so I ammended the WndProc(). the new stuff looks like this
bool configFS = true; //do we want the app to be configured as fullscreen? YES!
LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
UINT uMsg, // Message For This Window
WPARAM wParam, // Additional Message Information
LPARAM lParam) // Additional Message Information
{
switch (uMsg) // Check For Windows Messages
{
case WM_ACTIVATEAPP: //This handles alt tab issues--change to desktop size and minimize
{
if (!wParam){
if (active){
ShowWindow(hWnd,SW_SHOWMINNOACTIVE);
active=FALSE; // Program Is No Longer Active
ChangeDisplaySettings(NULL,0);
}
}else{
if (!active){
KillGLWindow(); // Kill Our Current Window
if (configFS){
if (!CreateGLWindow("fulscreen (r) 640 480 16 - 2D Font",640,480,16,configFS)){
return 0; // Quit If Window Was Not Created
}
}else{
if (!CreateGLWindow("windowed (r) 640 480 16 - 2D Font",640,480,16,configFS)){
return 0; // Quit If Window Was Not Created
}
}
ShowWindow(hWnd,SW_SHOW);
active=TRUE; // Program Is Active
}
}
return 0; // Return To The Message Loop
}
}
cheers