MFC下的日历表
// CalenderDlg.h : header file
// #if !defined(AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_)
#define AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_
#include"resource.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include"MyTime.h"
/////////////////////////////////////////////////////////////////////////////
// CCalenderDlg dialog class CCalenderDlg : public CDialog
{
// Construction
public:
CCalenderDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data
//{{AFX_DATA(CCalenderDlg)
enum { IDD = IDD_CALENDER_DIALOG };
CStatic m_StaticShowTime;
CButton m_b35;
CButton m_b34;
CButton m_b33;
CButton m_b32;
CButton m_b31;
CButton m_b30;
CButton m_b29;
CButton m_b28;
CButton m_b27;
CButton m_b26;
CButton m_b25;
CButton m_b24;
CButton m_b23;
CButton m_b22;
CButton m_b21;
CButton m_b20;
CButton m_b19;
CButton m_b1b8;
CButton m_b17;
CButton m_b16;
CButton m_b15;
CButton m_b14;
CButton m_b13;
CButton m_b12;
CButton m_11;
CButton m_b10;
CButton m_b9;
CButton m_b8;
CButton m_b7;
CButton m_b6;
CButton m_b5;
CButton m_b4;
CButton m_b3;
CButton m_b2;
CButton m_b1;
CMonthCalCtrl m_MonthCalCtrl;
CListBox m_ListBox;
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCalenderDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL // Implementation
protected:
HICON m_hIcon; // Generated message map functions
//{{AFX_MSG(CCalenderDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnGetdaystateMonthcalendar3(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnGo();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void setTimeToday();
MyTime mt ;
CMenu myMenu ;
int year , mouth , day ;
}; //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_)
MYTIME类
// MyTime.cpp: implementation of the MyTime class.
//
////////////////////////////////////////////////////////////////////// #include "stdafx.h"
#include "Calender.h"
#include "MyTime.h"
#include<ctime>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif //////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////////////////////////////////// MyTime::MyTime()
{
time_t now;
struct tm*fmt;
time(&now);
fmt=localtime(&now);
year=1900+fmt->tm_year;
month=1+fmt->tm_mon;
day=fmt->tm_mday;
} MyTime::~MyTime()
{ }
bool MyTime::fun(int y){
if ((y%4==0)&&(y%100!=0)||(y%400==0)) return true ;
return false;
}
int MyTime::sum(int y,int m){
int sum=0;
for(int j=1992;j<y;j++)
fun(j)?sum+=366:sum+=365;
for(int i=1;i<m;i++)
sum+=mouth(i);
return sum;
} int MyTime::mouth(int m)
{
if((m==4)||(m==6)||(m==9)||(m==11)) return 30;
if((m==2)&&(fun(year))) return 29;
if((m==2)&&(!fun(year))) return 28;
return 31;
}
int MyTime::getYear(){
return year;
}
int MyTime::getMouth(){
return month;
}
int MyTime::getDay(){
return day ;
}
void MyTime::setYear(int y){
year = y ;
}
void MyTime::setMouth(int m){
month = m ;
}
void MyTime::setDay(int d){
day = d ;
}
setTime类
// SetTime.cpp : implementation file
// #include "stdafx.h"
#include "Calender.h"
#include "SetTime.h" #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif /////////////////////////////////////////////////////////////////////////////
// SetTime dialog SetTime::SetTime(CWnd* pParent /*=NULL*/)
: CDialog(SetTime::IDD, pParent)
{
//{{AFX_DATA_INIT(SetTime)
m_strYear = _T("");
//}}AFX_DATA_INIT
} void SetTime::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SetTime)
DDX_Control(pDX, IDC_EDIT2, m_editMouth);
DDX_Text(pDX, IDC_EDIT1, m_strYear);
//}}AFX_DATA_MAP
} BEGIN_MESSAGE_MAP(SetTime, CDialog)
//{{AFX_MSG_MAP(SetTime)
//}}AFX_MSG_MAP
END_MESSAGE_MAP() /////////////////////////////////////////////////////////////////////////////
// SetTime message handlers void SetTime::OnOK()
{
// TODO: Add extra validation here
CString tempMouth , tempDay ;
UpdateData();
year=_ttoi(m_strYear); m_editMouth.GetWindowText(tempMouth);
mouth=_ttoi(tempMouth); CWnd * cw =GetDlgItem(IDC_EDIT3);
cw->GetWindowText(tempDay);
day = _ttoi(tempDay); CDialog::OnOK();
}
int SetTime::getYear(){
return year ;
}
int SetTime::getMouth(){
return mouth ;
}
int SetTime::getDay(){
return day ;
}
MFC下的日历表的更多相关文章
- MFC下OpenGL入门(可以用)
MFC下OpenGL入门 源文件 1, 建一工程文件,我这里命名为first,现在first工程里面我们没有添加任何东西,所有的东西都是MFC自动帮我们创建的. 2, 添加链接库.这一步很关键.打开菜 ...
- MFC下调用控制台和控制台下MFC库的支持
1.MFC下调用控制台 在CWinApp的InitInstance中对话框的DoModal之前加入 AllocConsole(); // 开辟控制台 SetConsoleTitle(_T(" ...
- MFC下的各种字符串类型和相互转换
MFC下的常用字符串数据类型表示的含义: L:Long 长 P:Point 指针 C:Const 常量 W:Wchar_t 宽字符 T:TCHAR STR:String 字符串 在看看MF ...
- [Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究
[Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究,目前MFC存在问题,win32没问题. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的Sc ...
- [Sciter系列] MFC下的Sciter–4.HTML与图片资源内置
[Sciter系列] MFC下的Sciter–4.HTML与图片资源内置,防止代码泄露. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterFrame程序,以此作 ...
- [Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互
[Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互,脚本调用底层自定义的方法函数. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterF ...
- [Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,语法
[Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,CSS部分自觉学习,重点说明Tiscript部分的常见语法和事件用法. 本系列文章的目的就是一步步构建出一个功 ...
- VC/MFC 下 递归遍历目录下的所有子目录及文件
在MFC下要实现文件夹的递归遍历,可用CFileFind类,依次读取文件夹下的子文件夹和文件,并判断通过判断是文件夹还是文件来决定递归遍历.递归遍历代码如下: /******************* ...
- MFC下MCI的使用播放音乐
最近研究了一下MFC下的音乐的播放,主要使用了MCI 1.需要包含的库文件 在链接资源里(link)添加库文件VFW32.lib winmm.lib 2.包含的头文件 #include <mms ...
随机推荐
- C#中linq报“Character literal must contain exactly one character”的错误提示
后台代码使用linq提示"Character literal must contain exactly one character": 网上看了一下提示在部分linq语句中直接写入 ...
- MicroStrategy笔试
1. coding判定二叉树是否是有序二叉树 2. 一个有序数组A(buffer足够大),和一个有序数组B,设计算法,merge两个数组后有序,不使用任何额外的内存空间 3. 100个点灯问题,初始状 ...
- 向ibus-table-wubi里添加属于自己的输入法(98五笔)
写在前面: 第三步整理每行的结构相对来说算是最难的,我的方法是先用文本编码转换专家将文本编码转换成utf-8无BOM(linux下有转换命令不会用,一定要是无BOM否则会在linux下打开乱码),再用 ...
- SIM卡厂商的识别方法
ICCID(SIM卡号码)的定义应该是: 1-6位:国际移动运营商识别码(IMSI),898600为中国移动,898601为中国联通 7-20位:移动和联通的定义是不同的. 中国移动: 第7.8 ...
- QT实现TCP通信服务器端和客户端(支持多个客户端)精简版
上星期接了个私活,工期两星期,报酬3000,写一个小软件,采集定向网络上的数据,并进行双向通信,捣鼓了两天,终于把QT中tcp通信这块调通了,找过N多例子,绝大部分都是基本的一个服务端一个客户端通信的 ...
- 开源流媒体处理库live555服务器端、客户端源代码分析总结
RTSP服务器端流程: 1. RTSP连接的建立过程 RTSPServer类用于构建一个RTSP服务器,该类同时在其内部定义了一个RTSPClientSession类,用于处理单独的客户会话. 首先创 ...
- JSP 9 大内置对象详解
内置对象特点: 1. 由JSP规范提供,不用编写者实例化. 2. 通过Web容器实现和管理 3. 所有JSP页面均可使用 4. ...
- Unity5.0 RPG角色扮演历险类游戏之 森林历险记
http://v.youku.com/v_show/id_XMTI1MjEyNjc4MA==.html? from=y1.7-1.2
- C++设计模式之状态模式(四)
4.状态模式总结 状态模式将一个对象在不同状态下的不同行为封装在一个个状态类中,通过设置不同的状态对象能够让环境对象拥有不同的行为.而状态转换的细节对于client而言是透明的.client不直接操作 ...
- oracle 分组后取每组第一条数据
‘数据格式 分组取第一条的效果 sql SELECT * FROM (SELECT ROW_NUMBER() OVER(PARTITION BY x ORDER BY y DESC) rn, test ...