Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » FullScreen: why does not work?
icon1.gif  Re: FullScreen: why does not work? [message #30047 is a reply to message #28742] Sun, 05 December 2010 04:56 Go to previous messageGo to previous message
alendar is currently offline  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

 
Read Message
Read Message
Read Message icon1.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Any tuple examples?
Next Topic: Multiple users over LAN
Goto Forum:
  


Current Time: Sun Aug 24 11:46:17 CEST 2025

Total time taken to generate the page: 0.03344 seconds