从CStatic类继承了一个类A
给程序添加一个新的对话框,在对话框上添加了一个静态文本框B。
通过winzard给文本框定义一个类型为A的变量。运行程序时出现unhandle exception问题。
问题出在哪里啊

解决方案 »

  1.   

    这样不能直接用winzard, 应该生成以后, 定义一个A的对象a, 子类化(SubClass)"静态文本框B"好了!
      

  2.   

    class CMyButton : public CButton {...};
    // m_myButton is a CMyButton object member of CAboutDlgBOOL CAboutDlg::OnInitDialog() 
    {
      CDialog::OnInitDialog();
      // IDC_BUTTON1 is the ID for a button on the 
      // dialog template used for CAboutDlg.
      m_myButton.SubclassDlgItem(IDC_BUTTON1, this);  return TRUE;  // Return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
    }就是这个  m_myButton.SubclassDlgItem(IDC_BUTTON1, this);