📄 1123dlg.cpp
字号:
// 1123Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "1123.h"
#include "1123Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMy1123Dlg dialog
CMy1123Dlg::CMy1123Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CMy1123Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMy1123Dlg)
m_year = 0;
m_day = 0;
m_hour = 0;
m_minute = 0;
m_month = 0;
m_second = 0;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMy1123Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMy1123Dlg)
DDX_Text(pDX, IDC_YEAR, m_year);
DDV_MinMaxInt(pDX, m_year, 2007, 2100);
DDX_Text(pDX, IDC_DAY, m_day);
DDV_MinMaxInt(pDX, m_day, 1, 31);
DDX_Text(pDX, IDC_HOUR, m_hour);
DDV_MinMaxInt(pDX, m_hour, 0, 23);
DDX_Text(pDX, IDC_MIUNTE, m_minute);
DDV_MinMaxInt(pDX, m_minute, 0, 59);
DDX_Text(pDX, IDC_MONTH, m_month);
DDV_MinMaxInt(pDX, m_month, 1, 12);
DDX_Text(pDX, IDC_SECOND, m_second);
DDV_MinMaxInt(pDX, m_second, 0, 59);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMy1123Dlg, CDialog)
//{{AFX_MSG_MAP(CMy1123Dlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMy1123Dlg message handlers
BOOL CMy1123Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
//设置 年 微调按钮
CSpinButtonCtrl *pYEAR = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN1);
ASSERT(pYEAR!=NULL);
//设置伙伴窗口
//int str=2007;
pYEAR->SetBuddy(GetDlgItem(IDC_YEAR));
pYEAR->SetRange(2007,2100);
pYEAR->SetPos(2007);
//设置 月 微调按钮
CSpinButtonCtrl *pMONTH = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN2);
ASSERT(pMONTH!=NULL);
//设置伙伴窗口
pMONTH->SetBuddy(GetDlgItem(IDC_MONTH));
pMONTH->SetRange(1,12);
pMONTH->SetPos(1);
//设置 日 微调按钮
CSpinButtonCtrl *pDAY = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN3);
ASSERT(pDAY!=NULL);
//设置伙伴窗口
pDAY->SetBuddy(GetDlgItem(IDC_DAY));
pDAY->SetRange(1,31);
pDAY->SetPos(1);
//设置 小时 微调按钮
CSpinButtonCtrl *pHOUR = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN4);
ASSERT(pHOUR!=NULL);
//设置伙伴窗口
//int str=2007;
pHOUR->SetBuddy(GetDlgItem(IDC_HOUR));
pHOUR->SetRange(0,23);
pHOUR->SetPos(12);
//设置 分钟 微调按钮
CSpinButtonCtrl *pMINUTE = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN5);
ASSERT(pMINUTE!=NULL);
//设置伙伴窗口
pMINUTE->SetBuddy(GetDlgItem(IDC_MIUNTE));
pMINUTE->SetRange(0,59);
pMINUTE->SetPos(0);
//设置 秒 微调按钮
CSpinButtonCtrl *pSECOND = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN6);
ASSERT(pSECOND!=NULL);
//设置伙伴窗口
pSECOND->SetBuddy(GetDlgItem(IDC_SECOND));
pSECOND->SetRange(0,59);
pSECOND->SetPos(0);
// 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
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CMy1123Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
//SYSTEMTIME *sysTime = new SYSTEMTIME();
/*SYSTEMTIME *sysTime = new SYSTEMTIME();
(*sysTime).wYear = 2008;
(*sysTime).wMonth =8;
(*sysTime).wDay = 28;
(*sysTime).wDayOfWeek =2;
(*sysTime).wHour =23;
(*sysTime).wMinute =15;
(*sysTime).wSecond =21;
(*sysTime).wMilliseconds = 10;
SetLocalTime(sysTime);*/
UpdateData(TRUE);
SYSTEMTIME sysTime;
sysTime.wYear =m_year;
sysTime.wMonth =m_month;
sysTime.wDay = m_day;
//sysTime.wDayOfWeek =2;
sysTime.wHour =m_hour;
sysTime.wMinute =m_minute;
sysTime.wSecond =m_second;
// sysTime.wMilliseconds = 10;
SetLocalTime(&sysTime);
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -