📄 datedialog.cpp
字号:
// DateDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Edit.h"
#include "DateDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDateDialog dialog
SYSTEMTIME CDateDialog::m_time;
LCID CDateDialog::m_id;
CListBox* CDateDialog::m_pListBox = NULL;
CDateDialog::CDateDialog(CWnd* pParent /*=NULL*/)
: CDialog(CDateDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CDateDialog)
m_strSel = _T("");
//}}AFX_DATA_INIT
}
void CDateDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDateDialog)
DDX_Control(pDX, IDC_DATEDIALOG_LIST, m_listBox);
DDX_LBString(pDX, IDC_DATEDIALOG_LIST, m_strSel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDateDialog, CDialog)
//{{AFX_MSG_MAP(CDateDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDateDialog message handlers
BOOL CDateDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_pListBox = &m_listBox; // set static member
GetLocalTime(&m_time);
// m_id = GetUserDefaultLCID();
EnumDateFormats(DateFmtEnumProc, m_id, DATE_SHORTDATE);
EnumDateFormats(DateFmtEnumProc, m_id, DATE_LONGDATE);
EnumTimeFormats(TimeFmtEnumProc, m_id, 0);
m_pListBox = NULL;
m_listBox.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CALLBACK CDateDialog::DateFmtEnumProc(LPTSTR lpszFormatString)
{
ASSERT(m_pListBox != NULL);
TCHAR buf[256];
VERIFY(GetDateFormat(m_id, 0, &m_time, lpszFormatString, buf, 256));
if (m_pListBox->FindStringExact(-1,buf) == CB_ERR)
m_pListBox->AddString(buf);
return TRUE;
}
BOOL CALLBACK CDateDialog::TimeFmtEnumProc(LPTSTR lpszFormatString)
{
ASSERT(m_pListBox != NULL);
TCHAR buf[256];
VERIFY(GetTimeFormat(m_id, 0, &m_time, lpszFormatString, buf, 256));
if (m_pListBox->FindStringExact(-1,buf) == CB_ERR)
m_pListBox->AddString(buf);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -