这个东西对自己没多大的用途,写它纯粹是因为最近比较闲,想好好的学一下MFC,代码不算多,可是由于对MFC框架和界面操作的不熟悉导致我吐血了一天才完成,难怪别人说Delphi程序员要比MFC程序员长寿20年-_-#
下面是界面截图
FUCK CSDN的图片上传挂了两周多了还没修好,直接贴代码了,MFC的框架映射关系真烦琐-_-#
AutoShutDownDlg.cpp:
//
AutoShutDownDlg.cpp : 实现文件
//
# include "stdafx.h"
# include "AutoShutDown.h"
# include "AutoShutDownDlg.h"
# ifdef _DEBUG
# define new DEBUG_NEW
# endif
# define WM_TRAYMESSAGE WM_USER+10000;
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialog
{
public :
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected :
virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV 支持
// 实现
protected :
DECLARE_MESSAGE_MAP()
};
CAboutDlg :: CAboutDlg() : CDialog(CAboutDlg :: IDD)
{
}
void CAboutDlg :: DoDataExchange(CDataExchange * pDX)
{
CDialog :: DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg , CDialog)
END_MESSAGE_MAP()
// CAutoShutDownDlg 对话框
CAutoShutDownDlg :: CAutoShutDownDlg(CWnd * pParent /* =NULL */ )
: CDialog(CAutoShutDownDlg :: IDD , pParent)
, m_Radio( 0 )
{
m_NowTime = _T( "" );
m_ShutTime = CTime :: GetCurrentTime();
m_IsRun = false ;
m_IsShow = true ;
m_hIcon = AfxGetApp() -> LoadIcon(IDR_MAINFRAME);
}
void CAutoShutDownDlg :: DoDataExchange(CDataExchange * pDX)
{
CDialog :: DoDataExchange(pDX);
DDX_Text(pDX , IDC_STATIC_NOW , m_NowTime);
DDX_DateTimeCtrl(pDX , IDC_SHUT_TIME , m_ShutTime);
DDX_Radio(pDX , IDC_RADIO1 , m_Radio);
}
BEGIN_MESSAGE_MAP(CAutoShutDownDlg , CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_TIMER()
// }}AFX_MSG_MAP
ON_BN_CLICKED(IDC_START , & CAutoShutDownDlg :: OnBnClickedStart)
ON_BN_CLICKED(IDC_STOP , & CAutoShutDownDlg :: OnBnClickedStop)
ON_NOTIFY(DTN_DATETIMECHANGE , IDC_SHUT_TIME , &
//
# include "stdafx.h"
# include "AutoShutDown.h"
# include "AutoShutDownDlg.h"
# ifdef _DEBUG
# define new DEBUG_NEW
# endif
# define WM_TRAYMESSAGE WM_USER+10000;
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialog
{
public :
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected :
virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV 支持
// 实现
protected :
DECLARE_MESSAGE_MAP()
};
CAboutDlg :: CAboutDlg() : CDialog(CAboutDlg :: IDD)
{
}
void CAboutDlg :: DoDataExchange(CDataExchange * pDX)
{
CDialog :: DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg , CDialog)
END_MESSAGE_MAP()
// CAutoShutDownDlg 对话框
CAutoShutDownDlg :: CAutoShutDownDlg(CWnd * pParent /* =NULL */ )
: CDialog(CAutoShutDownDlg :: IDD , pParent)
, m_Radio( 0 )
{
m_NowTime = _T( "" );
m_ShutTime = CTime :: GetCurrentTime();
m_IsRun = false ;
m_IsShow = true ;
m_hIcon = AfxGetApp() -> LoadIcon(IDR_MAINFRAME);
}
void CAutoShutDownDlg :: DoDataExchange(CDataExchange * pDX)
{
CDialog :: DoDataExchange(pDX);
DDX_Text(pDX , IDC_STATIC_NOW , m_NowTime);
DDX_DateTimeCtrl(pDX , IDC_SHUT_TIME , m_ShutTime);
DDX_Radio(pDX , IDC_RADIO1 , m_Radio);
}
BEGIN_MESSAGE_MAP(CAutoShutDownDlg , CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_TIMER()
// }}AFX_MSG_MAP
ON_BN_CLICKED(IDC_START , & CAutoShutDownDlg :: OnBnClickedStart)
ON_BN_CLICKED(IDC_STOP , & CAutoShutDownDlg :: OnBnClickedStop)
ON_NOTIFY(DTN_DATETIMECHANGE , IDC_SHUT_TIME , &