How to set a timer to a dialog
-
HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx
-
HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx
Hi,
//Win-Api, send a WM_TIMER(timer_event) message to a window timer_id = SetTimer(hwnd, timer_event, elapsed_time_ms, NULL) //Win-Api, call a function timer_id = SetTimer(NULL, 0, elapsed_time_ms, function_name) //and kill the timer KillTimer(timer_id)
or this links for MFC-Timer http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_CWnd.3a3a.SetTimer.asp[^] for API-Timer http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/settimer.asp[^] HTH Frank -
HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx
If is it mfc application , u can use this BOOL CTelnetServerDlg::OnInitDialog() { … … … … … … … … … SetTimer(100,20000,NULL); … … … … … … … … … } BEGIN_MESSAGE_MAP(CTelnetServerDlg, CDialog) //{{AFX_MSG_MAP(CTelnetServerDlg) … … … … … … … … … ON_WM_TIMER() ON_WM_DESTROY() … … … … … … … … … //}}AFX_MSG_MAP END_MESSAGE_MAP() void CTelnetServerDlg::OnTimer(UINT nIDEvent) { if (nIDEvent == 100) { // TODO: Add your message handler code here and/or call default } CDialog::OnTimer(nIDEvent); } void CTelnetServerDlg::OnDestroy() { KillTimer(100); CDialog::OnDestroy(); }