Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. help on dialog bar

help on dialog bar

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GANsJob
    wrote on last edited by
    #1

    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

    K 1 Reply Last reply
    0
    • G GANsJob

      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

      K Offline
      K Offline
      koloporanistka
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • K koloporanistka

        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

        J Offline
        J Offline
        jk chan
        wrote on last edited by
        #3

        Hi nina I wud like to make a suggestion :-D (Objcet oriented way i think). it will be better if you write a function inside dialog bar like UpdateHelp(CString &str); and call it from MainFrame.

        If u can Dream... U can do it

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups