Re: How to suppress SW_MAXIMIZE flag?
On Oct 23, 5:06 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
You can modify the system menu to not have a "Maximize" menu item, and in=
the OnSysCommand
handler, you can ignore any message that has SC_MAXIMIZE (in a dialog-bas=
ed app, there is
already a test for the About menu item, so put it there; remember that yo=
u need to ignore
the low-order 4 bits)
joe
On Thu, 23 Oct 2008 00:40:26 -0700 (PDT), Martin <marti...@mail.ru> wrote=
:
Hi.
The dialog window in my dialog based MFC application has its Maximize
button disabled, so, seems there's no way to maximize the window.
Anyway, a shortcut with "Maximized" value in the "Run" section can
easily run my application with an ugly maximized dialog window. I
know, in this case WinMain gets SW_MAXIMIZE as its nCmdShow
parameter's value. I tried 2 things, none of which helped:
1) Setting CWinApp::m_nCmdShow to SW_SHOWNORMAL early in InitInstance;
2) Dropping WS_MAXIMIZE window style bit in PreCreateWindow, also
tried in OnInitDialog;
So, the question is how to suppress SW_MAXIMIZE flag in MFC dialog
based application?
Thanks,
Martin
Joseph M. Newcomer [MVP]
email: newco...@flounder.com
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text -
- Show quoted text -
Joseph, it didn't helped... I created a sample MFC dialog based
application - the dialog already hadn't "Maximize" menu item (seems
this is managed by the framework). I slightly changed OnSysCommand
into this:
void CMFCDlgAppDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else if ((nID & 0xFFF0) == SC_MAXIMIZE)
{
// Do noting
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
I tested some more dialog based applications from SourceForge, also
msconfig.exe -- all of those had the defect. The only "normal" one was
Calculator.