Home » Community » Newbie corner » FullScreen: why does not work?
Re: FullScreen: why does not work? [message #30047 is a reply to message #28742] |
Sun, 05 December 2010 04:56   |
alendar
Messages: 47 Registered: January 2010 Location: Idaho, USA
|
Member |
|
|
I solved this with Win32 APIs. First I tried to use the U++ wrappers but I could not get them to work.
Here's the code:
bool isFullScreenModeActive;
virtual bool Key(dword key, int count) {
static dword style;
static Rect normalwindowrect;
switch (key) {
case K_F11:
if (!isFullScreenModeActive) {
// Get the current Top window's style bits
style = GetStyle();
// Strips the caption bit, which is the title bar
style = (style & ~WS_CAPTION);
// Save the "overlapped" or normal window shape
normalwindowrect = GetRect();
SetWindowLong(GetHWND(), GWL_STYLE, style);
// Get the full size of the screen
long cx = GetSystemMetrics(SM_CXSCREEN);
long cy = GetSystemMetrics(SM_CYSCREEN);
// Expand the window to full size
SetWindowPos(GetHWND(),HWND_TOP,0,0,cx,cy,SWP_SHOWWINDOW);
//or use Maximize(false) if you like a
//delayed resizing, even with zoom effects turned off
} else {
// Set the caption bit back so we can get our title bar back
style |= WS_CAPTION;
// Pass to windows (Style() method gets confused on SyncCaption0)
SetWindowLong(GetHWND(), GWL_STYLE, style);
// Return size to normal; key flag is SWP_FRAMECHANGED
SetWindowPos(GetHWND(),HWND_TOP,
normalwindowrect.left,
normalwindowrect.top,
normalwindowrect.Width(),
normalwindowrect.Height(), SWP_SHOWWINDOW|SWP_FRAMECHANGED);
}
// Track logically in our application
isFullScreenModeActive = !isFullScreenModeActive;
break;
}
return false;
}
This was on MS Windows XP Professional V 2002 SP 3
U++ 2791
This is a win32 only fix. This works on a TopWindow while your in it, so you don't have to use the constructor method.
I might try getting the virtual window size so I can zoom across multiple screens.
The trick to getting the title bar back after your zoom is the SWP_FRAMECHANGED flag. Without this Windoze doesn't know to rebuild the window frame after you added the WS_CAPTION bit back in.
You can use the TopWindow.Maximize() function, but for some reason it still tries to do effects when you pass a false bit, so I used the SetWindowPos instead for the zoom.
I haven't tried this with any windows besides a TopWindow.
This covers the taskbar on the bottom on my computer. Sometimes there is a delay in minimizing the taskbar.
Edit from 5 min later:
To go across all screens just change:
cx = GetSystemMetrics(SM_CXVIRTUALSCREEN);
long cy = GetSystemMetrics(SM_CYSCREEN);
cy = GetSystemMetrics(SM_CYVIRTUALSCREEN);
cd7651feeb698f6ac6cec1f6deda5e5b
[Updated on: Sun, 05 December 2010 05:03] Report message to a moderator
|
|
|
 |
|
FullScreen: why does not work?
By: 281264 on Tue, 14 September 2010 18:02
|
 |
|
Re: FullScreen: why does not work?
By: cbpporter on Tue, 14 September 2010 18:57
|
 |
 |
Re: FullScreen: why does not work?
By: alendar on Sun, 05 December 2010 04:56
|
 |
|
Re: FullScreen: why does not work?
By: koldo on Sun, 05 December 2010 11:06
|
 |
|
Re: FullScreen: why does not work?
By: kohait00 on Tue, 21 December 2010 10:47
|
 |
|
Re: FullScreen: why does not work?
By: 281264 on Tue, 21 December 2010 11:20
|
 |
|
Toggle FullScreen on X11
By: oan1971 on Wed, 22 December 2010 12:54
|
 |
|
Re: Toggle FullScreen on X11
By: koldo on Wed, 22 December 2010 14:12
|
 |
|
Re: Toggle FullScreen on X11
By: koldo on Sun, 26 December 2010 17:10
|
 |
|
Re: Toggle FullScreen on X11
By: 281264 on Mon, 27 December 2010 11:22
|
 |
|
Re: Toggle FullScreen on X11
By: mirek on Mon, 27 December 2010 18:52
|
 |
|
Re: Toggle FullScreen on X11
By: 281264 on Mon, 27 December 2010 19:04
|
 |
|
Re: Toggle FullScreen on X11
By: mirek on Mon, 27 December 2010 19:32
|
Goto Forum:
Current Time: Sun Aug 24 11:46:17 CEST 2025
Total time taken to generate the page: 0.03344 seconds
|