Making MFC go fullscreen
-
At first I thought this wasn't a problem at all. But now that I started an OpenGL-MFC based solution, all of a sudden I fail at even attempting to make this MFC app go full screen. I searched allot of sites over this 'issue', but I was really amazed by not finding any info on this. I only run into this problem using MFC. My rather silly simple problem is, how to make an MFC app go full screen? And I really mean fullscreen. Thanks for any help.
-
At first I thought this wasn't a problem at all. But now that I started an OpenGL-MFC based solution, all of a sudden I fail at even attempting to make this MFC app go full screen. I searched allot of sites over this 'issue', but I was really amazed by not finding any info on this. I only run into this problem using MFC. My rather silly simple problem is, how to make an MFC app go full screen? And I really mean fullscreen. Thanks for any help.
I don't know OpenGL, and i think OpenGL have a function for screen ! Anyway, you can use GetDeviceCaps for getting display coordinate and resize your program window to full screen ! :-D My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
At first I thought this wasn't a problem at all. But now that I started an OpenGL-MFC based solution, all of a sudden I fail at even attempting to make this MFC app go full screen. I searched allot of sites over this 'issue', but I was really amazed by not finding any info on this. I only run into this problem using MFC. My rather silly simple problem is, how to make an MFC app go full screen? And I really mean fullscreen. Thanks for any help.
-
At first I thought this wasn't a problem at all. But now that I started an OpenGL-MFC based solution, all of a sudden I fail at even attempting to make this MFC app go full screen. I searched allot of sites over this 'issue', but I was really amazed by not finding any info on this. I only run into this problem using MFC. My rather silly simple problem is, how to make an MFC app go full screen? And I really mean fullscreen. Thanks for any help.
I've been doing either this (in InitDialog) [ccode] BOOL returnCode = SetWindowPos( this->GetActiveWindow(), 0, 0, ::GetSystemMetrics(SM_CXMAXIMIZED), ::GetSystemMetrics(SM_CYMAXIMIZED), SWP_SHOWWINDOW); [/ccode] or this: [ccode] CRect rect; rect.top = 0; rect.left = 0; rect.right = ::GetSystemMetrics(SM_CXMAXIMIZED); rect.bottom = ::GetSystemMetrics(SM_CXMAXIMIZED); this->GetActiveWindow()->MoveWindow(rect,TRUE); [/ccode] If you do anything with OnSize, remember that it is called twice - once before InitDialog, and then again after InitDialog, and you can't move controls until InitDialog runs because they don't exit yet. (you didn't ask this, and I think I'm telling it correctly. You might also be interested in the EasySize class for moving dialog controls around as you resize a dialog - it is very helpful. (search this site if you are interested)
-
Yes this does work. Although... it's not exactly a common known solution (if there is one) :) But it does work. Only problem left is that in XP I still have the window borders showing up. I 'solved' this by making the 'rectDesktop' 2 pixels larger. Hopefully that works on any desktop theme. Else I need to know a way to get the current border width. Thanks for your help, it helped allot.:)
-
I've been doing either this (in InitDialog) [ccode] BOOL returnCode = SetWindowPos( this->GetActiveWindow(), 0, 0, ::GetSystemMetrics(SM_CXMAXIMIZED), ::GetSystemMetrics(SM_CYMAXIMIZED), SWP_SHOWWINDOW); [/ccode] or this: [ccode] CRect rect; rect.top = 0; rect.left = 0; rect.right = ::GetSystemMetrics(SM_CXMAXIMIZED); rect.bottom = ::GetSystemMetrics(SM_CXMAXIMIZED); this->GetActiveWindow()->MoveWindow(rect,TRUE); [/ccode] If you do anything with OnSize, remember that it is called twice - once before InitDialog, and then again after InitDialog, and you can't move controls until InitDialog runs because they don't exit yet. (you didn't ask this, and I think I'm telling it correctly. You might also be interested in the EasySize class for moving dialog controls around as you resize a dialog - it is very helpful. (search this site if you are interested)
Still, using both this and the solution 2 posts back, I get thin borders around the screen. A simple way to get the current border width would solve this. ...and this post got me to look up 'GetSystemMetrics' again, and ::GetSystemMetrics(SM_CXBORDER), ::GetSystemMetrics(SM_CYBORDER) both do the trick I needed. i.e. it all works now! thanks :) Long live..... MFC?