Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCHtmlView Pin
Ivan Cachicatari15-Dec-04 6:57
Ivan Cachicatari15-Dec-04 6:57 
GeneralWindows Xp Theme Pin
Leyu15-Dec-04 6:23
Leyu15-Dec-04 6:23 
GeneralRe: Windows Xp Theme Pin
Andy Hunter15-Dec-04 11:41
Andy Hunter15-Dec-04 11:41 
GeneralGeneral Another Main Dialog Pin
sweep12315-Dec-04 6:22
sweep12315-Dec-04 6:22 
GeneralRe: General Another Main Dialog Pin
toxcct15-Dec-04 7:56
toxcct15-Dec-04 7:56 
GeneralRe: General Another Main Dialog Pin
Grahamfff15-Dec-04 9:35
Grahamfff15-Dec-04 9:35 
GeneralRe: General Another Main Dialog Pin
Blake Miller15-Dec-04 10:21
Blake Miller15-Dec-04 10:21 
GeneralRe: General Another Main Dialog Pin
toxcct16-Dec-04 2:30
toxcct16-Dec-04 2:30 
ok, let's say the datas to pass to the dialog are a bool, a CString, and int.
then, you create a specific constructor :
CmyDialog::CmyDialog (<font color=#0000FF>bool </font>bFlag, CString strTitle, <font color=#0000FF>int </font>iSize) 
            : CDialog(CmyDialog::IDD),
            m_bFlag(bFlag),
            m_strTitle(strTitle),
            m_iSize(iSize) {
}

of course, you had previously added the correct members to your class :
<font color=#0000FF>class </font>CmyDialog : <font color=#0000FF>public </font>CDialog {
    <font color=#008000>//...</font>
<font color=#0000FF>protected</font>:
    <font color=#0000FF>bool     </font>m_bFlag;
    CString  m_strTitle;
    <font color=#0000FF>int      </font>m_iSize;
<font color=#008000>//.....
</font>};

then, you can call you function, let's say, when "Open" Button is clicked on the first dialog :
<font color=#0000FF>void </font>CDialog1::OnSClickOpenBtn() {
    <font color=#0000FF>bool </font>b = 0;
    CString str = <font color=#808080>"This is the title of my dialog"</font>;
    <font color=#0000FF>int </font>iSz = 5;
 
    CmyDialog dlg(b, str, iSz);   <font color=#008000>// Implicit call of the constructor
</font>    dlg.DoModal();                <font color=#008000>// Assuming that your dialog is modal
</font>}

the last thing you have to implement in you code is the following :
BOOL CmyDialog::OnInitDialog() {
    <font color=#0000FF>this</font>->SetWindowText(m_strTitle);
    <font color=#0000FF>if </font>(m_bFlag) {
        <font color=#008000>// do some action if the flag is set...</font>
    }
    <font color=#008000>//...
</font>    <font color=#0000FF>return </font>TRUE;
}

hope you understand better now Wink | ;)


TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralHELP - how to send Byte Array from VB to C(MFC) Pin
pinhas15-Dec-04 6:11
pinhas15-Dec-04 6:11 
GeneralIncorporation of C files to C++ Pin
Keck15-Dec-04 5:32
Keck15-Dec-04 5:32 
GeneralRe: Incorporation of C files to C++ Pin
toxcct15-Dec-04 5:37
toxcct15-Dec-04 5:37 
GeneralRe: Incorporation of C files to C++ Pin
Blake Miller15-Dec-04 10:25
Blake Miller15-Dec-04 10:25 
Generaladding manage extension to exiting c++ application. Pin
pnpfriend15-Dec-04 5:27
pnpfriend15-Dec-04 5:27 
Questionhow to access mainframe from the object Pin
josephvan15-Dec-04 3:06
josephvan15-Dec-04 3:06 
AnswerRe: how to access mainframe from the object Pin
David Crow15-Dec-04 3:37
David Crow15-Dec-04 3:37 
GeneralRe: how to access mainframe from the object Pin
josephvan15-Dec-04 18:01
josephvan15-Dec-04 18:01 
General&quot;Writing&quot; to parallel port in XP Pin
Blubbo15-Dec-04 2:05
Blubbo15-Dec-04 2:05 
Generalminimum size of win32 application Pin
includeh1015-Dec-04 1:17
includeh1015-Dec-04 1:17 
GeneralRe: minimum size of win32 application Pin
gamitech15-Dec-04 1:21
gamitech15-Dec-04 1:21 
GeneralRe: minimum size of win32 application Pin
User 665815-Dec-04 2:04
User 665815-Dec-04 2:04 
GeneralRe: minimum size of win32 application Pin
David Crow15-Dec-04 3:39
David Crow15-Dec-04 3:39 
GeneralRe: minimum size of win32 application Pin
includeh1015-Dec-04 19:45
includeh1015-Dec-04 19:45 
GeneralDuplicate Items in Treeview Pin
@cE15-Dec-04 1:08
@cE15-Dec-04 1:08 
GeneralRe: Duplicate Items in Treeview Pin
includeh1015-Dec-04 1:20
includeh1015-Dec-04 1:20 
GeneralRe: Duplicate Items in Treeview Pin
josephvan15-Dec-04 18:14
josephvan15-Dec-04 18:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.