PDA

View Full Version : Border when using Full Screen



Furrage
03-15-2002, 09:16 PM
I've been experimenting with full screen mode and noticed that even when I use the WS_POPUP window style I get a sunken border around the screen. Is that normal, or is there a way around it? I'm running W98.

zeckensack
03-16-2002, 02:44 AM
If you're changing your window's style from bordered to popup (I tend to do that and it seems to work fine), you have to make a special call before Win32 acknowledges that. That's somewhere in the MSDN docs.


//save your window style in case you want to change it back

//switch to popup style
SetWindowLong(window,GWL_STYLE,WS_POPUP);
//here comes the important bit
SetWindowPos(window,0,0,0,0,0,SWP_NOSIZE|SWP_NOMOV E|SWP_NOZORDER|SWP_FRAMECHANGED);

HTH http://www.opengl.org/discussion_boards/ubb/smile.gif

Furrage
03-17-2002, 01:28 PM
I just tried it. It did not work. Any other suggestions?

Furrage
03-18-2002, 06:52 AM
Could this have anything to do with how I create the window. I use MS VC++, Create a win32 application, use MFC as a shared dll and then create my window like this...




bsWnd::bsWnd(ogsGame *pGame) { // Constructor for the class.
...
FullScreenMode = FALSE; // Assume window not in full screen mode.
if (GoFullScreen(ogsSCREENWIDTH, ogsSCREENHEIGHT, ogsBITSPERPIXEL))
Create(NULL, NULL, WS_POPUP, CRect(0, 0, ogsSCREENWIDTH, ogsSCREENHEIGHT), NULL, NULL, WS_EX_APPWINDOW);
else Create(NULL, "Bog Shooter ver. 1.0");
// Create the window.
...
}

BOOL bsWnd::GoFullScreen(int pWidth, int pHeight, int pBits) {
// Switches window to full screen at specified resolution.
DEVMODE dmScreenSettings; // Device mode.
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
// Clear memory.
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
// Set size of device mode structure.
dmScreenSettings.dmPelsWidth = pWidth;
// Specify screen width.
dmScreenSettings.dmPelsHeight = pHeight;
// Specify screen height.
dmScreenSettings.dmBitsPerPel = pBits;
// Specify bits per pixel.
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
// Indicate fields changed.
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
// Change display to full screen. If failed...
MessageBox(NULL, "Switch to fullscreen failed.");
// Note failure.
FullScreenMode = FALSE; // Note not in full screen.
}
else {
FullScreenMode = TRUE; // In full screen mode.
ShowCursor(FALSE); // Hide mouse.
}
return FullScreenMode; // Switched to full screen.
}


Based on how I see everyone else code this might seem strange, but I found MFC too confusing to learn and straight windows programming too complex when I started out. Its only now I'm discovering my technique might be abnormal.

Furrage
03-18-2002, 08:51 AM
Ignore/Delete this topic. I'm going to make major changes to my program and hopefully it won't be relevant when I'm done.