calendar.cpp

来自「个人计算机定时自动执行软件,是 一个值得看看的程序。」· C++ 代码 · 共 68 行

CPP
68
字号
// Calendar.cpp : implementation file
//

#include "stdafx.h"
#include "clock.h"
#include "Calendar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCalendar dialog


CCalendar::CCalendar(CWnd* pParent /*=NULL*/)
	: CDialog(CCalendar::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCalendar)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCalendar::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCalendar)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCalendar, CDialog)
	//{{AFX_MSG_MAP(CCalendar)
	ON_WM_SHOWWINDOW()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCalendar message handlers

BOOL CCalendar::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SYSTEMTIME strtime;
    GetLocalTime(&strtime);
	
	CString str;
	str.Format(TEXT("今天是:  %d-%d-%d  (%d:%02d)"),strtime.wYear,strtime.wMonth,strtime.wDay,strtime.wHour,strtime.wMinute);	
	SetWindowText(str);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCalendar::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	CRect rect;
	GetWindowRect(&rect);
	SetWindowPos(NULL,250,200,rect.Width(),rect.Height(),0);	
}

⌨️ 快捷键说明

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