setdlg.cpp

来自「也是一款定时关机的程序」· C++ 代码 · 共 126 行

CPP
126
字号
// SetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "OnTime.h"
#include "SetDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog


CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetDlg)
	m_default = _T("");
	m_late = _T("");
	m_mode = -1;
	m_record = FALSE;
	m_min = FALSE;
	//}}AFX_DATA_INIT
}


void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetDlg)
	DDX_Text(pDX, IDC_EDIT_DEFAULT, m_default);
	DDX_Text(pDX, IDC_EDIT_LATER, m_late);
	DDX_Radio(pDX, IDC_RADIO_DLG, m_mode);
	DDX_Check(pDX, IDC_CHECK_WRITE, m_record);
	DDX_Check(pDX, IDC_CHECK_MIN, m_min);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
	//{{AFX_MSG_MAP(CSetDlg)
	ON_BN_CLICKED(IDC_CHECK_WRITE, OnCheckWrite)
	ON_EN_CHANGE(IDC_EDIT_DEFAULT, OnChangeEditDefault)
	ON_EN_CHANGE(IDC_EDIT_LATER, OnChangeEditLater)
	ON_BN_CLICKED(IDC_RADIO_CLOSE, OnRadioClose)
	ON_BN_CLICKED(IDC_RADIO_DLG, OnRadioDlg)
	ON_BN_CLICKED(IDC_BUTTON_DEFAULT, OnButtonDefault)
	ON_BN_CLICKED(IDC_CHECK_MIN, OnCheckMin)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers

void CSetDlg::OnCheckWrite() 
{
	UpdateData(TRUE);	
}

void CSetDlg::OnChangeEditDefault() 
{
	UpdateData(TRUE);	
}

void CSetDlg::OnChangeEditLater() 
{
	UpdateData(TRUE);	
}

void CSetDlg::OnRadioClose() 
{
	UpdateData(TRUE);	
}

void CSetDlg::OnRadioDlg() 
{
	UpdateData(TRUE);	
}

void CSetDlg::OnCheckMin() 
{
	UpdateData(TRUE);
}

void CSetDlg::OnButtonDefault() 
{
	m_default="15";
	m_late="5";
	m_min=0;
	m_mode=0;
	m_record=0;
	UpdateData(FALSE);
}

void CSetDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CString m_WindowText,OwnWinText="设置";
	SetWindowText(OwnWinText);
	CWnd *p=GetForegroundWindow();
	if(p)
		p->GetWindowText(m_WindowText);
	else
		m_WindowText=OwnWinText;
	if(m_WindowText.Compare(OwnWinText))
		CDialog::OnCancel();
	
	CDialog::OnTimer(nIDEvent);
}

BOOL CSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	SetTimer(3,10000,NULL);
	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 + -
显示快捷键?