宣告 timer 資源 #define IDC_Timer 2948 宣告訊息映射函數 BEGIN_MESSAGE_MAP( WaitProceDlg , CDialog) ON_WM_TIMER() END_MESSAGE_MAP() 實作回呼函式 onTimer void WaitProceDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default CDialog::OnTimer(nIDEvent); } 啟動 timer SetTimer(IDC_Timer,500,NULL);