Modify a Modal window?
Say I created a second dialog in a Visual C++ MFC project. I then give it a class named CSecondDialog.
The way to make it show up is
However, lets say I've got a textbox on the dialog. How could I fill it with text before the window shows up? I didn't see a CSecondDialog::OnInitDialog() function anywhere.
I tried doing this
But when that ran it gave me a debug error =[.
dlg.m_editBox.ShowWindowText ( _T("TEXT") );
How can I put text into that exit box (variable: m_editBox)?
Thanks in advance :-)
Which version of MSVC?
Is in the properties of the dialogs class (right click on class in the 'Class View') look under 'Overrides' for 'OnInitDialog'.
In V6 you can add a variable usign the class wizard and set a default value.
Look also at UpdateData().
EDIT You can not set the text of a window / control until it has been created. DoModal() calls create on the dialog.
Worked! Thanks :)
Originally Posted by novacain