Click to See Complete Forum and Search --> : Fullscreen (frame-less/title-less) window
MaxDonnelly
May 14th, 2010, 11:51 PM
I am developing a program which will always be fullscreen, similar to software you may have seen at restaurants to take orders. Basically I do not want the window to have a resizeable frame or one at all or a title bar. Making the border extend beyond the screen seemed to be the easiest solution except that the CreateWindowEx function will only make a window more than 14 pixels bigger than the desktop resolution. I have moved the window 7 pixels left of the left side of the screen to hide that part of the border. Regardless of how wide the window is made or where it is positioned the window is limited to show at least 3 pixels of the frame (1 on one side 2 on the other or hidden left 3 pixels on right).
Is there an easy solution to make a window exactly or larger than the desktop size with no (visible) frame? Would prefer a simple solution in the CreateWindowEx function that I am hopefully overlooking.
Also, how would I force the window to be on top of the taskbar? I wouldn't have an issue with the user having to change the startmenu setting to just not always be on top of windows but it appears this option is no longer available in Windows 7 so it would have to be written in the program.
hoxsiew
May 15th, 2010, 08:11 AM
I don't know if this helps, but I just toggle the WS_CAPTION style in the main frame window. I have a tool-bar button for this as I allow the user to switch modes:
void CMainFrame::OnViewFullscreen()
{
if(m_bFullScreen){
m_bFullScreen=0;
ModifyStyle(0,WS_CAPTION);
ShowWindow(SW_RESTORE);
}else{
m_bFullScreen=1;
ModifyStyle(WS_CAPTION,0);
ShowWindow(SW_SHOWMAXIMIZED);
}
}
I've never tried this with Win7 until now, but you're right; it doesn't cover the taskbar. I don't know what to do about that. Maybe there's a new API for that.
MaxDonnelly
May 15th, 2010, 03:52 PM
I have not done work with API before. I am trying to understand the difference between CreateWindowEx and CreateWindow, I guess for that matter all the extended functions in the API. The only answer I could really find from searching the net is the fact that the former is extended. I assumed this ment that all of the non-extended parameters worked in CreateWindowEx plus some additional parameters but this appears not to be true.
Is CreateWindow essentially lower-level? Allowing more options to edit how the window is displayed or interacts and should I completely stop using any extended functions.
This is where my assumption comes from.
<code>
hwnd = CreateWindowEx(
(WS_EX_TOOLWINDOW) & ~ (WS_CAPTION)
</code>
will not display a window.
hoxsiew
May 15th, 2010, 05:48 PM
Most of the "Ex" suffixed functions were later additions to the original API to account for newly added functionality. CreateWindowEx() allows extended styles that were added later. They are in a different category than the normal window styles and shouldn't be mixed (as you seem to be doing above). See MSDN:
HWND CreateWindowEx(
DWORD dwExStyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
Extended style is parameter 1 and style is parameter 4. WS_EX_TOOLWINDOW should be part of the extended style (parameter 1) and WS_CAPTION should be part of the normal style (parameter 4).
MaxDonnelly
May 15th, 2010, 10:13 PM
I have had that MSDN page open while working on this don't know how I didn't see that suppose I figured my answer was within the first parameter and never looked passed it.
Anyways I now have a window with no border or min/max/close buttons but the title bar is still there as you can see in my code I have simply set the original style parameter to 0.
hwnd = CreateWindowEx(
WS_EX_TOPMOST,
g_szClassName,
"",
0,
0, 0, 1024, 600,
NULL, NULL, hInstance, NULL);
...btw topmost puts the window on top of the taskbar even in Windows 7
Is there a way to remove the title bar? As far as I see WS_EX_DLGMODALFRAME is the only one which doesn't include a title bar...although it still shows up when replacing WS_EX_TOPMOST in the code above even though MSDN specifically says it won't unless WS_CAPTION is in the 4th parameter.
The title bar must be removed because the height of the window is again limited by the desktop resolution so I cannot simply hide the title off screen and extend the window the extra 25/26 pixels.
Igor Vartanov
May 16th, 2010, 04:34 AM
Use bare WS_POPUP style.
MaxDonnelly
May 16th, 2010, 03:37 PM
Thank you both very much for your help. I look forward to becoming an active member of the codeguru community and reciprocating the help to other members.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.