www.pudn.com > SysTime.zip > TimeTestDlg.cpp, change:2006-01-13,size:2664b


// TimeTestDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "TimeTest.h" 
#include "TimeTestDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CTimeTestDlg dialog 
 
CTimeTestDlg::CTimeTestDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CTimeTestDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CTimeTestDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
} 
 
void CTimeTestDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CTimeTestDlg) 
		// NOTE: the ClassWizard will add DDX and DDV calls here 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CTimeTestDlg, CDialog) 
	//{{AFX_MSG_MAP(CTimeTestDlg) 
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CTimeTestDlg message handlers 
 
BOOL CTimeTestDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	CenterWindow(GetDesktopWindow());	// center to the hpc screen 
 
	// TODO: Add extra initialization here 
	 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
 
 
void CTimeTestDlg::OnButton1()  
{ 
	// TODO: Add your control notification handler code here 
	CString sTime,sYear,sMonth,sDay; 
	CString sHour,sMinute,sSecond; 
 SYSTEMTIME CurTime; 
 GetLocalTime(&CurTime); 
 sYear.Format(_T("%d年"),CurTime.wYear); 
 sMonth.Format(_T("%d月"),CurTime.wMonth); 
 sDay.Format(_T("%d日"),CurTime.wDay); 
 sHour.Format(_T("%d时"),CurTime.wHour); 
 sMinute.Format(_T("%d分"),CurTime.wMinute); 
 sSecond.Format(_T("%d秒"),CurTime.wSecond); 
 
 sTime =  sYear+ sMonth + sDay + sHour +sMinute +sSecond; 
  // CurTime.wHour 
  // CurTime.wMinute 
  // CurTime.wSecond IBM的 
 AfxMessageBox(sTime); 
 
	/* 
_itoa( stime->wDay,str, 4); 
	str1=str; 
	MessageBox(str1); 
_itoa( stime->wHour,str, 4); 
	str1=str; 
	MessageBox(str1); 
*/ 
/* 
str=itoa(stime->wYear); 
	MessageBox(str); 
str=itoa(stime->wMonth); 
	MessageBox(str); 
str=itoa(stime->wDay); 
	MessageBox(str); 
str=itoa(stime->wHour); 
	MessageBox(str); 
str=itoa(stime->wMinute); 
	MessageBox(str); 
str=itoa(stime->wSecond); 
	MessageBox(str);*/ 
}