一個簡單的鬧鐘程式。資源下載下傳位址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);
}
為了測試時鐘,做的一個小功能,勿拍磚。