but the system menu is not modified.
Joseph M. Newcomer wrote:
You need to do several other things.
First, you need to remove the menu item for restore from the system menu. Do a
GetSystemMenu(FALSE) [I think it is FALSE, check the docs] and simply remove the
SC_RESTORE item from the menu.
This does not deal with the double-click-in-the-caption-bar resizing. What I usually do
is handle the OnSize request, and if the request comes in as a Restore, I look at the
previous state I was in. If it is "maximized" I force it to iconize, and if it was
iconzied, I force it to maximize. The PreCreateWindow doesn't come into the situation.
Note that when a window app is first started, there is a parameter which is set to
indicate its desired initial state. You need to defeat this by ignoring this parameter.
This has to happen when the window is created, not in PreCreateWindow.
joe
On Mon, 10 Jul 2006 12:08:30 +0100, JoeB <joe@nospam.com> wrote:
Hi,
How can i start my app maximized and prohibit resizing the app. So I can have maximized and minimized but not in between.
This doesn't seem to work:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// Modify the Window class or styles here by modifying the CREATESTRUCT cs
cs.style =
WS_OVERLAPPEDWINDOW |
WS_OVERLAPPED | // main window
WS_CAPTION | // title bar
WS_MINIMIZEBOX | // minimise box
WS_MAXIMIZEBOX | // maximise box
// WS_SIZEBOX |
WS_MAXIMIZE | // create maximised
WS_SYSMENU | // sysmenu and icon
0x00;
// clear the resize box
cs.style = cs.style & (~WS_SIZEBOX);
return CFrameWnd::PreCreateWindow(cs);
}
J
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm