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

📄 closedlg.cpp

📁 也是一款定时关机的程序
💻 CPP
字号:
// CloseDlg.cpp : implementation file
//

#include "stdafx.h"
#include "OnTime.h"
#include "CloseDlg.h"
#include "OnTCDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCloseDlg dialog


CCloseDlg::CCloseDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCloseDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCloseDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCloseDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCloseDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCloseDlg, CDialog)
	//{{AFX_MSG_MAP(CCloseDlg)
	ON_WM_TIMER()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCloseDlg message handlers

void CCloseDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if(nIndex++>2)
	{
		KillTimer(2);
		COnTCDlg * pf=(COnTCDlg *)AfxGetApp()->m_pMainWnd;
		OnOK();
//		pf->SendMessage(WM_CLOSE,0,0);
		pf->OnCancel(); 
//		ExitWindowsEx(13,1);
		ExitWindows(EWX_SHUTDOWN | EWX_POWEROFF, 0);
	}
	
	CDialog::OnTimer(nIDEvent);
}

BOOL CCloseDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	COnTCDlg * pf=(COnTCDlg *)AfxGetApp()->m_pMainWnd;
	m_alert=pf->m_alert;
	nIndex=0;
	MoveWindow(0,0,800,600);
	SetTimer(2,1000,NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCloseDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CFont fnt;
	if(m_alert.GetLength())
	{
		fnt.CreateFont(1200/m_alert.GetLength(),1500/(2*m_alert.GetLength()+1),0,0,FW_HEAVY,0,0,0,ANSI_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Simkai");
		dc.SetTextColor(RGB(255,0,0));
		dc.SetBkColor(RGB(191,191,191));
		dc.SelectObject(fnt);
		dc.TextOut(12,110,m_alert);
	}
	
}

⌨️ 快捷键说明

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