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

📄 alertdlg.cpp

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

#include "stdafx.h"
#include "OnTime.h"
#include "AlertDlg.h"
#include "OnTCDlg.h"
#include<MMSYSTEM.H>

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

/////////////////////////////////////////////////////////////////////////////
// CAlertDlg dialog


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


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


BEGIN_MESSAGE_MAP(CAlertDlg, CDialog)
	//{{AFX_MSG_MAP(CAlertDlg)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAlertDlg message handlers

BOOL CAlertDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	COnTCDlg * pf=(COnTCDlg *)AfxGetApp()->m_pMainWnd;
	m_alert=pf->m_alert;
	MoveWindow(0,0,800,600);
	FILE *p;
	if((p=fopen("Ontime.wav","rb"))==NULL)
		PlaySound((LPCTSTR)IDR_WAVE,AfxGetInstanceHandle(),SND_RESOURCE|SND_LOOP|SND_ASYNC);
	else
	{
		PlaySound("Ontime.wav",NULL,SND_LOOP|SND_ASYNC);//==FALSE)
		fclose(p);
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAlertDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	PlaySound(NULL,NULL,SND_LOOP|SND_ASYNC);
	
	CDialog::OnCancel();
}

void CAlertDlg::OnOK() 
{
	// TODO: Add extra validation here
	PlaySound(NULL,NULL,SND_LOOP|SND_ASYNC);
	
	CDialog::OnOK();
}

void CAlertDlg::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);
	}
	
	// Do not call CDialog::OnPaint() for painting messages
}

⌨️ 快捷键说明

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