date.cpp

来自「支持ACCESS数据库的数据的查询、打印、统计等」· C++ 代码 · 共 91 行

CPP
91
字号
// date.cpp : implementation file
//

#include "stdafx.h"
#include "Material_MIS.h"
#include "date.h"

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

/////////////////////////////////////////////////////////////////////////////
// Cdate dialog


Cdate::Cdate(CWnd* pParent /*=NULL*/)
	: CDialog(Cdate::IDD, pParent)
{
	//{{AFX_DATA_INIT(Cdate)

	m_text1 = COleDateTime::GetCurrentTime();
	m_text2 = COleDateTime::GetCurrentTime();
	//}}AFX_DATA_INIT
}


void Cdate::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Cdate)
	DDX_Text(pDX, IDC_EDIT1, m_text1);
	DDX_Text(pDX, IDC_EDIT2, m_text2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Cdate, CDialog)
	//{{AFX_MSG_MAP(Cdate)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Cdate message handlers

void Cdate::OnOK() 
{
	// TODO: Add extra validation here
   	 UpdateData(true);
	 if (m_text2.GetDayOfYear()-m_text1.GetDayOfYear()>31)
	 {
		AfxMessageBox("你查的时间段超出31天!", MB_ICONEXCLAMATION);	
	    return;
	 }
	CDialog::OnOK();
}

void Cdate::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

//DEL void Cdate::OnChangeEdit1() 
//DEL {
//DEL 	// TODO: If this is a RICHEDIT control, the control will not
//DEL 	// send this notification unless you override the CDialog::OnInitDialog()
//DEL 	// function and call CRichEditCtrl().SetEventMask()
//DEL 	// with the ENM_CHANGE flag ORed into the mask.
//DEL 	
//DEL 	// TODO: Add your control notification handler code here
//DEL 	
//DEL }

BOOL Cdate::OnInitDialog() 
{
	CDialog::OnInitDialog(); 
    //m_text1=m_t.Format("%Y-%m-%d 00:00:00");
	// TODO: Add extra initialization here
//	m_text2.Format("%d-%d-%d %d:%d:%d",m_t.GetYear(),m_t.GetMonth(),m_t.GetDay(),
	//	m_t.GetHour(),m_t.GetMinute(),m_t.GetSecond());
    m_text1.SetDateTime(m_text1.GetYear(),m_text1.GetMonth(),m_text1.GetDay(),
		0,0,0);
	UpdateData(false);	

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?