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. How to set a timer to a dialog

How to set a timer to a dialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • Z Offline
    Z Offline
    Zeeshan Bilal
    wrote on last edited by
    #1

    HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx

    F M 2 Replies Last reply
    0
    • Z Zeeshan Bilal

      HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx

      F Offline
      F Offline
      Frank K
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • Z Zeeshan Bilal

        HI, How can i set timer Event to a dialog... means how can i creat it, set it , kill it , any code plz thanx

        M Offline
        M Offline
        Member 162462
        wrote on last edited by
        #3

        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(); }

        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