mfc界面编程中!想给几个编辑框一组默认为0 的值,但是运行错误!
我关联的变量全部是CEdit类型 也就是控件类型的变量,再在OnInitDialog函数里面添加如下代码:
BOOL CAnalyzeDlg::OnInitDialog()
{
// CDialog::OnInitDialog();
CDialogEx::OnInitDialog();
m_Aturnerror.SetWindowText("0");
m_Atootherror.SetWindowText("0");
m_CircularRunout.SetWindowText("0");
m_Maxburr.SetWindowText("0");
m_MeasuredDeviation1.SetWindowText("0");
m_MeasuredDeviation2.SetWindowText("0");
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
为什么编译可以通过 一个error也没有 但是不能运行,运行的时候出现系统崩溃的问题!请问大侠如何解决????急急急~~~~
我关联的变量全部是CEdit类型 也就是控件类型的变量,再在OnInitDialog函数里面添加如下代码:
BOOL CAnalyzeDlg::OnInitDialog()
{
// CDialog::OnInitDialog();
CDialogEx::OnInitDialog();
m_Aturnerror.SetWindowText("0");
m_Atootherror.SetWindowText("0");
m_CircularRunout.SetWindowText("0");
m_Maxburr.SetWindowText("0");
m_MeasuredDeviation1.SetWindowText("0");
m_MeasuredDeviation2.SetWindowText("0");
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
为什么编译可以通过 一个error也没有 但是不能运行,运行的时候出现系统崩溃的问题!请问大侠如何解决????急急急~~~~
另外,你确定是这里的问题么
确定你的Dialog是继承自CDialogEx?
你在debug下。在Call stack看看执行的时候停留在哪里,哪里就可能出错。。
CDialogEx::OnInitDialog();
还是换成CDialog::OnInitDialog();
BOOL CAccuracyDlg::OnInitDialog()
{
CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
} // Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_ctrlEditSetting.SetWindowText("0");
m_ctrlEditSettingLimit.SetWindowText("0");
m_ctrlEditMeasure.SetWindowText("0");
m_ctrlEditMeasureError.SetWindowText("0");
return TRUE; // return TRUE unless you set the focus to a control
}
应该是控件变量关联问题。