Re: Dialog is changing from modal to modeless
Hi Joe,
On Fri, 22 Feb 2008 13:55:48 -0500, Joseph M. Newcomer
<newcomer@flounder.com> wrote:
Are you saying that this transition appears to be accidental?
Yes, the users called me when the effect appeared and they told me
that it happens rarely but sometime.
You show some random code here, but the code that matters is the code coupled to the Yes
and No buttons. Looking at the startup code reveals nothing when the failure is clearly
in the shutdown code.
The code for the buttons is so simple, I can not imagine what should
go wrong here.
The Dialog is like the AfxMessageBox the meaning of the buttons is
given on runtime.
class CDlgButton : public CButton
{
public:
CDlgButton ();
~CDlgButton ();
void SetID (UINT id) { mMyID = id; }
UINT BtnID () const { return mMyID; }
private:
UINT mMyID;
}
class CInfoDlg : publi CDialog
{
public:
...
private:
CDlgButton mButton[3];
};
void CInfoDlg::DoDataExchange (CDataExchange* pDX)
{
...
DDX_Control (pDX, ID_INF_BTN_0, mButton[0]);
DDX_Control (pDX, ID_INF_BTN_1, mButton[1]);
DDX_Control (pDX, ID_INF_BTN_2, mButton[2]);
}
void CInfoDlg::OnInfBtn0 ()
{
EndDialog (mButton[0].BtnID ());
}
I think I will investigate in the direction malachi.moses has showed
up. I dont know how it can happen that the dialog is displayed more
than once but I also can not rule out that this may happen.
Thanks to malachi.moses for this hint.
Best regards
Walter