Hi,
I have a main dialog box with a button. This button displays another dialog box. I want to initialize some controls on this second dialog box but I want these controls to be initialized ONCE : when the program starts.
If I try this :
void CMainDlg:
nBnClicked()
{
CMyDialog myDlg;
myDlg.ctrl_checkbox.EnableWindow(FALSE);
myDlg.DoModal();
}
...I get an "Debug Assertion Failed" error which I understand because the dialog box has not been created yet (the DoModal() method does it).
If I put my initialisation commands in the CMyDialog::OnInitDialog() function it works BUT this function is called each time the dialog is displayed so my changes are lost each time the dialog is displayed.
- How can I just iniitalise these controls ONCE when the program starts ?
- How can I create my second dialog once ? and then reuse it as long as the program lives ?
Thanks.
I have a main dialog box with a button. This button displays another dialog box. I want to initialize some controls on this second dialog box but I want these controls to be initialized ONCE : when the program starts.
If I try this :
void CMainDlg:
{
CMyDialog myDlg;
myDlg.ctrl_checkbox.EnableWindow(FALSE);
myDlg.DoModal();
}
...I get an "Debug Assertion Failed" error which I understand because the dialog box has not been created yet (the DoModal() method does it).
If I put my initialisation commands in the CMyDialog::OnInitDialog() function it works BUT this function is called each time the dialog is displayed so my changes are lost each time the dialog is displayed.
- How can I just iniitalise these controls ONCE when the program starts ?
- How can I create my second dialog once ? and then reuse it as long as the program lives ?
Thanks.