help on dialog bar
-
Hi, Im using dialog bar. Which has Only one CStatic ctrl. Now i want to update the text(with current time) in the static ctrl on every second; How can I achieve this. Regards, GAN
1. Create timer in the beginning of the application: timer = SetTimer(1, 1000, NULL); 2. Add event ON_WM_TIMER() void CMainFrame::OnTimer(UINT nIDEvent) { if (nIDEvent == 1) { // IDC_STAT is an ID of static controll CStatic* cap = (CStatic*)m_wndDlgBar.GetDlgItem(IDC_STAT); if (cap) { CTime t = CTime::GetCurrentTime(); cap->SetWindowText(t.Format("%d/%m/%y %H:%M:%S")); } } CFrameWnd::OnTimer(nIDEvent); } 3. At the end of the application don't forget to destroy the timer: KillTimer(timer); Nina
-
1. Create timer in the beginning of the application: timer = SetTimer(1, 1000, NULL); 2. Add event ON_WM_TIMER() void CMainFrame::OnTimer(UINT nIDEvent) { if (nIDEvent == 1) { // IDC_STAT is an ID of static controll CStatic* cap = (CStatic*)m_wndDlgBar.GetDlgItem(IDC_STAT); if (cap) { CTime t = CTime::GetCurrentTime(); cap->SetWindowText(t.Format("%d/%m/%y %H:%M:%S")); } } CFrameWnd::OnTimer(nIDEvent); } 3. At the end of the application don't forget to destroy the timer: KillTimer(timer); Nina