如题

解决方案 »

  1.   

    // CornSeed.cpp : implementation file
    //#include "stdafx.h"
    #include "Identification.h"
    #include "CornSeed.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CCornSeed dialog
    CCornSeed::CCornSeed(CWnd* pParent /*=NULL*/)
    : CDialog(CCornSeed::IDD, pParent)
    {
    //{{AFX_DATA_INIT(CCornSeed)
    //}}AFX_DATA_INIT
    }
    void CCornSeed::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CCornSeed)
    DDX_Control(pDX, IDOK, m_ok);
    //}}AFX_DATA_MAP
    }
    BEGIN_MESSAGE_MAP(CCornSeed, CDialog)
    //{{AFX_MSG_MAP(CCornSeed)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CCornSeed message handlers#if !defined(AFX_CORNSEED_H__589AF1F7_BFC7_4397_8158_AAD75DFE3099__INCLUDED_)
    #define AFX_CORNSEED_H__589AF1F7_BFC7_4397_8158_AAD75DFE3099__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // CornSeed.h : header file
    ///////////////////////////////////////////////////////////////////////////////
    // CCornSeed dialogclass CCornSeed : public CDialog
    {
    // Construction
    public:
    CCornSeed(CWnd* pParent = NULL);   // standard constructor// Dialog Data
    //{{AFX_DATA(CCornSeed)
    enum { IDD = IDD_DIALOG_CORN };
    CButton m_ok;
    //}}AFX_DATA
    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CCornSeed)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
    //}}AFX_VIRTUAL// Implementation
    protected: // Generated message map functions
    //{{AFX_MSG(CCornSeed)
    virtual void OnOK();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };//{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_CORNSEED_H__589AF1F7_BFC7_4397_8158_AAD75DFE3099__INCLUDED_)CCornSeed 是一个对话框类,m_ok是按钮控件的变量,我在上一层对话框用CCornSeed dlg;dlg.DoModal();的方式调用对话框,如果不定义m_ok,程序就好好的,一定义就出现上面的错误。
      

  2.   

    CPP文件里还做了其它的操作没?这么直接定义变量应该不会出错的啊.把CPP整个贴出来看看.
      

  3.   

    你重写了virtual void OnOK()?是不是里面的代码有问题啊,这么奇怪的问题第一次听说,而且两个人同时发生就更加奇怪了
      

  4.   

    m_ok 与你的对话框上的按钮控件关联起来了吗?