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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Timers

Timers

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++lounge
13 Posts 5 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.
  • C Offline
    C Offline
    cberam
    wrote on last edited by
    #1

    Hi I just have a general question about setting up timers. How would I go about setting up timers in C++?? Basically, I would like to set timers to wait for certain events, once the timers pop, I want the program to take a different route. Any ideas??? Pls tell me some useful links for Timers sample code Thanks in advance Ram

    T 1 Reply Last reply
    0
    • C cberam

      Hi I just have a general question about setting up timers. How would I go about setting up timers in C++?? Basically, I would like to set timers to wait for certain events, once the timers pop, I want the program to take a different route. Any ideas??? Pls tell me some useful links for Timers sample code Thanks in advance Ram

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      set the timer to the duration you need (have a look at Cwnd::SetTimer() and Cwnd::KillTimer()). also override the events you need to catch. when the message it catched, set a flag. this way, when the timer times out, if the flag is set, the event appeared, otherwise, it didn't.


      TOXCCT >>> GEII power

      C 1 Reply Last reply
      0
      • T toxcct

        set the timer to the duration you need (have a look at Cwnd::SetTimer() and Cwnd::KillTimer()). also override the events you need to catch. when the message it catched, set a flag. this way, when the timer times out, if the flag is set, the event appeared, otherwise, it didn't.


        TOXCCT >>> GEII power

        C Offline
        C Offline
        cberam
        wrote on last edited by
        #3

        Hi Thanks for the reply. But i need help on without using MFC in C++ Thnks agian ram

        T J D 3 Replies Last reply
        0
        • C cberam

          Hi Thanks for the reply. But i need help on without using MFC in C++ Thnks agian ram

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          ok, but the philosophy is the same...


          TOXCCT >>> GEII power

          C 1 Reply Last reply
          0
          • C cberam

            Hi Thanks for the reply. But i need help on without using MFC in C++ Thnks agian ram

            J Offline
            J Offline
            jmkhael
            wrote on last edited by
            #5

            Check: SetTimer KillTimer Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            C 1 Reply Last reply
            0
            • T toxcct

              ok, but the philosophy is the same...


              TOXCCT >>> GEII power

              C Offline
              C Offline
              cberam
              wrote on last edited by
              #6

              Hello, where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help.. Thanks agin Ram

              T D 2 Replies Last reply
              0
              • J jmkhael

                Check: SetTimer KillTimer Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                C Offline
                C Offline
                cberam
                wrote on last edited by
                #7

                Hello, Thanks for help. where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help..I'm struggling Thanks agin Ram

                J J 2 Replies Last reply
                0
                • C cberam

                  Hello, where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help.. Thanks agin Ram

                  T Offline
                  T Offline
                  toxcct
                  wrote on last edited by
                  #8

                  are you programming with Win32 ? if so, you call SetTimer() in your events handler, into the event switch case relative to the action that must start the timer up.


                  TOXCCT >>> GEII power

                  C 1 Reply Last reply
                  0
                  • C cberam

                    Hello, Thanks for help. where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help..I'm struggling Thanks agin Ram

                    J Offline
                    J Offline
                    jmkhael
                    wrote on last edited by
                    #9

                    You will receive a message WM_TIMER each time the timer is consumed You can catch it in your mail loop, (GetMessage ...) Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                    1 Reply Last reply
                    0
                    • C cberam

                      Hello, Thanks for help. where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help..I'm struggling Thanks agin Ram

                      J Offline
                      J Offline
                      Jens Doose
                      wrote on last edited by
                      #10

                      And you will need a message loop. Jens

                      1 Reply Last reply
                      0
                      • C cberam

                        Hi Thanks for the reply. But i need help on without using MFC in C++ Thnks agian ram

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #11

                        SetTimer() and KillTimer() are still used.


                        "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                        1 Reply Last reply
                        0
                        • C cberam

                          Hello, where can i set the timer(SetTimer()) in the main() function. I tried but the Timer procedure(the call back routine) never got invoked. Pls help.. Thanks agin Ram

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          cberam wrote: I tried but the Timer procedure(the call back routine) never got invoked. What does the relevant code look like?


                          "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

                          1 Reply Last reply
                          0
                          • T toxcct

                            are you programming with Win32 ? if so, you call SetTimer() in your events handler, into the event switch case relative to the action that must start the timer up.


                            TOXCCT >>> GEII power

                            C Offline
                            C Offline
                            cberam
                            wrote on last edited by
                            #13

                            Hello toxcct, sorry for the delayed reply. Anyway you have a good idea..on invoking timers. Thanks a lot Ram

                            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