⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datedlg.cpp

📁 EVC开发的读取系统时间
💻 CPP
字号:
// dateDlg.cpp : implementation file
//

#include "stdafx.h"
#include "date.h"
#include "dateDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDateDlg dialog

CDateDlg::CDateDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDateDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDateDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CDateDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDateDlg)
	DDX_Control(pDX, IDC_RTC_ERROR, m_RTC_error);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDateDlg, CDialog)
	//{{AFX_MSG_MAP(CDateDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnClock)
	ON_BN_CLICKED(IDC_BUTTON2, OnClose)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDateDlg message handlers

BOOL CDateDlg::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


	SYSTEMTIME CurTime;
	GetLocalTime(&CurTime);

	if (CurTime.wYear<2008)
	{
		SetWindowPos(&wndNoTopMost,0,0,240,320,SWP_SHOWWINDOW);
		HWND hWndFull=::FindWindow(_T("HHTaskBar"),NULL);
		::ShowWindow(hWndFull, SW_HIDE);
		if (!CreateProcess(_T("ctlpnl.exe"), _T("cplmain.cpl,13"), 0, 0, 0, 0, 0, 0, 0, NULL)) 
		{ 
			return FALSE; 
		}
		else
		{
			m_RTC_error.ShowWindow(SW_HIDE);
		}
	}
	else
	{
		CDialog::DestroyWindow();
		return FALSE;
	}
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CDateDlg::OnClock() 
{
	// TODO: Add your control notification handler code here
	m_RTC_error.ShowWindow(SW_HIDE);
	CreateProcess(_T("ctlpnl.exe"), _T("cplmain.cpl,13"), 0, 0, 0, 0, 0, 0, 0, NULL);
	
}

void CDateDlg::OnClose() 
{
	// TODO: Add your control notification handler code here
	SYSTEMTIME CurTime;
	GetLocalTime(&CurTime);

	if (CurTime.wYear<2008)
	{
		m_RTC_error.ShowWindow(SW_SHOW);
	}
	else
	{		
		HWND hWndFull=::FindWindow(_T("HHTaskBar"),NULL);
		::ShowWindow(hWndFull, SW_SHOW);
		CDialog::DestroyWindow();
	}
		
}

⌨️ 快捷键说明

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