Re: Funky weird dialog resize FINALLY!

From: Mike Welch (michaelw_at_techemail.com)
Date: 03/11/04


Date: 11 Mar 2004 05:39:04 -0800

I never got an answer to this question...after about 5 hours of
searching everything under the sun, it occurred to me that the dialog
was getting resized when it was reactivated after the first time.
Evidently, the m_bFullScreen hack is NOT considered by the parent
class, at least not after it's loaded and displayed the first time.

The solution was to override the OnActivate and comment out the call
to the parent, as such:

void CPTopTweakDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL
bMinimized)
{
   //CDialog::OnActivate(nState, pWndOther, bMinimized);
}

Evidently nothing was happening in the OnActivate anyway because
everything seems to be fine. Stubbing it out solved the resize issue.

Posting this in case anybody else runs into this stupid problem.

Mike

michaelw@techemail.com (Mike Welch) wrote in message news:<b3ce3d49.0402261652.4b5003a4@posting.google.com>...
> I have an app that's doing exactly what I want now, except one strange
> issue. The app was setup as a dialog (modal dialog). Per help here,
> I have turned off the full screen and OK button so it does precicely
> what I want. However, when I show the About/Help dialog, it comes up
> just fine too. But when I click OK on it, the underlying dialog then
> goes full screen. It gets resized!
>
> Below is the InitDialog routines, which is where I'd suspect the
> problem to be. However, maybe a Paint has to be trapped or something?
> It's strange that it changes size once the other dialog is gone.
>
> I tried doing a DoModal() on the help/about dialog, but that generated
> an error, I think because you can only have 1 modal dialog in an app,
> or at least in the same thread because of how message handling works
> if I'm not mistaken. When I changed the DoModal() to a plain Show(),
> it then worked fine. However, an additional issue now is that
> technically you can return to the main dialog and open a second
> help/about dialog...third...ninteenth :) I can hack out a fix for
> this though. :)
>
> Thanks to everybody who helped here. I would have been really stuck
> without you guys.
>
> Mike
>
>
> Dialog 1:
> --------
>
> BOOL CPTopTweakDlg::OnInitDialog()
> {
> m_bFullScreen = FALSE; // Prevent full-screen mode when
> app is a dialog
>
> CDialog::OnInitDialog();
>
> SHDoneButton(m_hWnd, SHDB_HIDE); // Turn off OK button when app is
> a dialog
>
> SetIcon(m_hIcon, TRUE); // Set big icon
> SetIcon(m_hIcon, FALSE); // Set small icon
>
> CenterWindow(GetDesktopWindow()); // center to the PPC screen
>
> <snip>
>
> SetCheckboxResetValue(bAutoReset); // Automatically reset?
>
> } else
> this->EndDialog(IDOK); // This dialog is modal. This sets modal
> result which closes main
>
> return TRUE; // return TRUE unless you set the focus to a control
> }
>
> Dialog 2:
> --------
>
> BOOL CPocketopHelp::OnInitDialog()
> {
> m_bFullScreen = FALSE; // mw This prevents full-screen
> mode
>
> CDialog::OnInitDialog();
>
> SHDoneButton(m_hWnd, SHDB_HIDE); // mw This turns off the OK
> button
>
> return TRUE; // return TRUE unless you set the focus to a control
> // EXCEPTION: OCX Property Pages should return FALSE
> }