一个简单的闹钟程序。资源下载地址http://download.csdn.net/detail/lingxiu0613/4695608
主要逻辑是:
设置一个临时时间变量m_strOwnTime,获取系统时间变量strSysTime,然后映射OnTimer函数,
在m_strOwnTime==strSysTime的时候,响闹铃
简单源码:
void CclockDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CString strSysTime;
strSysTime = GetSysTime();
if (signal_y != 0)
{
if (strSysTime == m_strOwnTime)//判断时间
{
PlaySound("clock.wav" , NULL , 1);
MessageBox("时间到了...");
}
}
CDialog::OnTimer(nIDEvent);
}
为了测试时钟,做的一个小功能,勿拍砖。