settingdlg.cpp

来自「非比寻常的超级记事本 1.日历控件的使用 2.托盘技术 3.开机后应用程序」· C++ 代码 · 共 96 行

CPP
96
字号
// SettingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SuperNotepad.h"
#include "SettingDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSettingDlg dialog


CSettingDlg::CSettingDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSettingDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSettingDlg)
		// NOTE: the ClassWizard will add member initialization here
	m_strTipInfo = _T("");
	//}}AFX_DATA_INIT
}


void CSettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSettingDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	DDX_Control(pDX, IDC_CMB_TIP_TYPE, m_cmbTipType);
	DDX_Control(pDX, IDC_CMB_MINUTE, m_cmbMinute);
	DDX_Control(pDX, IDC_CMB_HOUR, m_cmbHour);
	DDX_Text(pDX, IDC_EDT_INFO, m_strTipInfo);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
	//{{AFX_MSG_MAP(CSettingDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSettingDlg message handlers

BOOL CSettingDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString str = _T( "" );

	for ( int i = 0; i < 24; i++ )
	{
		str.Format( _T( "%02d" ), i );
		m_cmbHour.AddString( str );
	}
	m_cmbHour.SetCurSel( 0 );
	for ( i = 0; i < 60; i++ )
	{
		str.Format( _T( "%02d" ), i );
		m_cmbMinute.AddString( str );
	}
	m_cmbMinute.SetCurSel( 0 );

	m_cmbTipType.AddString( _T( "时间提示" ) );
	m_cmbTipType.AddString( _T( "关机" ) );
	m_cmbTipType.SetCurSel( 0 );
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSettingDlg::OnOK()
{
	UpdateData();

	if ( m_strTipInfo.IsEmpty() )
	{
		AfxMessageBox( _T( "请输入设置时间的提示信息 !" ), MB_ICONINFORMATION );
		return;
	}
	CString strHour    = _T( "" );
	m_cmbHour.GetLBText( m_cmbHour.GetCurSel(), strHour );

	CString strMinute  = _T( "" );
	m_cmbMinute.GetLBText( m_cmbMinute.GetCurSel(), strMinute );

	m_strTime.Format( _T( "%s:%s" ), strHour, strMinute );
	m_cmbTipType.GetLBText( m_cmbTipType.GetCurSel(), m_strTipType );

	CDialog::OnOK();
}

⌨️ 快捷键说明

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