To load the IDD_BIOGRAPHY dialog
Return to Main

Resume :

  • To add a member function.
  • To invoke the modal dialog box.
  • Details ...

    1. Activate the IDC_CREATED - (member of the IDD_ABOUTBOX dialog):
      1. ClassWizard, Add member function - (object ID: IDC_CREATED):
      2. On the View menu, click ClassWizard.
        The MFC ClassWizard dialog box appears, click the Message Maps tab.
      3. In the Class name box, select the class CAboutDlg.
      4. In the Object IDs list, select the IDC_CREATED.
      5. In the Messages list, select the BN_CLICKED.
      6. Click Add Function.
      7. The Add Member Function dialog box appears, click OK.
        To accept the default Member function name -
        OnCreated display(or rename it) and then click OK.
        The new item message -
        OnCreated...... ON_IDC_CREATED:BN_CLICKED appearing in the Member functions list.
        ClassWizard makes changes to TestVC0Dlg.cpp file after you’ve added the member function. Examine these changes ...

        TestVC0Dlg.cpp file
        - the new Text Code is red.

        // TestVC0Dlg.cpp : implementation file
        //

        #include "stdafx.h"
        #include "TestVC0.h"
        #include "TestVC0Dlg.h"

        #ifdef _DEBUG
        #define new DEBUG_NEW
        #undef THIS_FILE
        static char THIS_FILE[] = __FILE__;
        #endif

        /////////////////////////////////////////////////////////////////////////////
        // CAboutDlg dialog used for App About

        class CAboutDlg : public CDialog
        {
        public:
        CAboutDlg();

        // Dialog Data
        //{{AFX_DATA(CAboutDlg)
        enum { IDD = IDD_ABOUTBOX };
        CString m_edsource;
        //}}AFX_DATA

        // ClassWizard generated virtual function overrides
        //{{AFX_VIRTUAL(CAboutDlg)
        protected:
        virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
        //}}AFX_VIRTUAL

        // Implementation
        protected:
        //{{AFX_MSG(CAboutDlg)
        virtual BOOL OnInitDialog();
        afx_msg void OnCreated();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
        };

        CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
        {
        //{{AFX_DATA_INIT(CAboutDlg)
        m_edsource = _T("");
        //}}AFX_DATA_INIT
        }

        void CAboutDlg::DoDataExchange(CDataExchange* pDX)
        {
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CAboutDlg)
        DDX_Text(pDX, IDC_EDSOURCE, m_edsource);
        //}}AFX_DATA_MAP
        }

        BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
        //{{AFX_MSG_MAP(CAboutDlg)
        ON_BN_CLICKED(IDC_CREATED, OnCreated)
        //}}AFX_MSG_MAP
        END_MESSAGE_MAP()

        /////////////////////////////////////////////////////////////////////////////
        // CTestVC0Dlg dialog
        ...................................................................................................................................................
        ...................................................................................................................................................

        ...
        void CAboutDlg::OnCreated()
        {
        // TODO: Add your control notification handler code here

        }
      8. ClassWizard, Edit the Code - (function OnCreated):
      9. In the ClassWizard dialog box, select the Message Maps tab and in the Class Name box,
        select the class CAboutDlg.
      10. In the Member Functions list, select the function name - OnCreated:
        Choose Edit Code
        -or-
        Double-click the function name.
        The insertion point moves to the function in theTestVC0Dlg.cpp file. Edit the Text Code, examine these changes ...

        Note:
        #include "Biography.h" - to insert the contents of the Biography.h file into the TestVC0Dlg.cpp file.

        TestVC0Dlg.cpp file
        - - the new Text Code is red.

        #include "stdafx.h"
        #include "TestVC0.h"
        #include "TestVC0Dlg.h"
        #include "Biography.h"

        #ifdef _DEBUG
        #define new DEBUG_NEW
        #undef THIS_FILE
        static char THIS_FILE[] = __FILE__;
        #endif

        /////////////////////////////////////////////////////////////////////////////
        // CAboutDlg dialog used for App About

        ...
        ...................................................................................................................................................
        ...................................................................................................................................................

        void CAboutDlg::OnCreated()
        {
        CBiography dlgBiog;
        dlgBiog.DoModal();

        // TODO: Add your control notification handler code here

        }
    Return to Main