OnCancel()出错,跟进去出现错误是:Unhandled exception in Reports.exe(KERNEL32.DLL):0xE06D7363:Microsoft C++ Exception.void CBehaviorName::OnCancel()
{
// CBehaviorName::OnCancel();
CDialog::OnCancel();
}
请大家帮我看一下,困扰了好长时间了,先谢谢了各位
{
// CBehaviorName::OnCancel();
CDialog::OnCancel();
}
请大家帮我看一下,困扰了好长时间了,先谢谢了各位
将停下来的代码贴出来。
class CBehaviorName : public CDialog
{
// DECLARE_DYNAMIC(CBehaviorName)
// Construction
public:
CBehaviorName(CWnd* pParent = NULL); // standard constructor
virtual ~CBehaviorName();
// Dialog Data
//{{AFX_DATA(CBehaviorName)
enum { IDD = IDD_BEHAVIORNAME };
CEdit m_Username;
CDateTimeCtrl m_Etime;
CDateTimeCtrl m_Stime;
BOOL m_bStime;
BOOL m_bEtime;
BOOL m_bUsername;
CString m_sUserName;
COleDateTime m_tStime;
COleDateTime m_tEtime;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBehaviorName)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CBehaviorName)
afx_msg void OnCheckbtime();
afx_msg void OnChecketime();
afx_msg void OnCheckUsername();
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditUsername();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif 然后是在BehaviorName.cpp中
CBehaviorName::CBehaviorName(CWnd* pParent /*=NULL*/)
: CDialog(CBehaviorName::IDD, pParent)
{
//{{AFX_DATA_INIT(CBehaviorName)
m_bStime = FALSE;
m_bEtime = FALSE;
m_bUsername = FALSE;
m_sUserName = _T("");
m_tStime = COleDateTime::GetCurrentTime();
m_tEtime = COleDateTime::GetCurrentTime();
//}}AFX_DATA_INIT
}CBehaviorName::~CBehaviorName()
{
}void CBehaviorName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBehaviorName)
DDX_Control(pDX, IDC_EDIT_USERNAME, m_Username);
DDX_Control(pDX, IDC_DATETIMEPICKER2, m_Etime);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_Stime);
DDX_Check(pDX, IDC_CHECK_BTIME, m_bStime);
DDX_Check(pDX, IDC_CHECK_ETIME, m_bEtime);
DDX_Check(pDX, IDC_CHECK_USERNAME, m_bUsername);
DDX_Text(pDX, IDC_EDIT_USERNAME, m_sUserName);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_tStime);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_tEtime);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBehaviorName, CDialog)
//{{AFX_MSG_MAP(CBehaviorName)
ON_BN_CLICKED(IDC_CHECK_BTIME, OnCheckbtime)
ON_BN_CLICKED(IDC_CHECK_ETIME, OnChecketime)
ON_BN_CLICKED(IDC_CHECK_USERNAME, OnCheckUsername)
ON_EN_CHANGE(IDC_EDIT_USERNAME, OnChangeEditUsername)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CBehaviorName message handlers
BOOL CBehaviorName::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBehaviorName::OnOK()
{
CDialog::OnOK();
}void CBehaviorName::OnCancel()
{
// CBehaviorName::OnCancel(); //退出主窗口
CDialog::OnCancel();
// DestroyWindow();}void CBehaviorName::OnCheckbtime()
{
// TODO: Add your control notification handler code here
m_Stime.EnableWindow(((CButton *)GetDlgItem(IDC_CHECK_BTIME))->GetCheck());
// m_tStime.GetCurrentTime();
}void CBehaviorName::OnChecketime()
{
// TODO: Add your control notification handler code here
m_Etime.EnableWindow(((CButton *)GetDlgItem(IDC_CHECK_ETIME))->GetCheck());
}void CBehaviorName::OnCheckUsername()
{
// TODO: Add your control notification handler code here
m_Username.EnableWindow(((CButton *)GetDlgItem(IDC_CHECK_USERNAME))->GetCheck());
}