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 run a function every minute?

How to run a function every minute?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
15 Posts 8 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.
  • T toxcct

    pliiiiiiiiiiiiiiiiizz read the MSDN before asking such questions !!!! OnTimer() of course !!!!! :doh::eek: X|


    TOXCCT >>> GEII power

    2 Offline
    2 Offline
    224917
    wrote on last edited by
    #4

    thats okey toxcct they shld check codeproject b4 msdn. tats our aim...:-D


    greatest thing is to do wot others think you cant
    suhredayan@omniquad.com

    messenger :suhredayan@hotmail.com

    1 Reply Last reply
    0
    • T toxcct

      pliiiiiiiiiiiiiiiiizz read the MSDN before asking such questions !!!! OnTimer() of course !!!!! :doh::eek: X|


      TOXCCT >>> GEII power

      S Offline
      S Offline
      SiddharthAtw
      wrote on last edited by
      #5

      Yes. this is should be the first choice, even before MSDN. Rather microsoft should trigger it with F1.:laugh::laugh::laugh:

      2 1 Reply Last reply
      0
      • S StarMeteor

        Dear All, I am working on my project (in MFC) which require me to run certain function every minute...I would like to know how I can do so except using a loop to check if the time is reached. I would prefer a "signal and slot" like method as there are some other functions need to run so I can use loop method to do so :((~_~ Thanks~

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #6

        USE THIS #define ID_timer 1000 use add window handler to deliver window message WM_TIMER OnTimer SetTimer(ID_timer,1000*60,NULL); to end timer KillTimer(ID_timer); Alok Gupta visit me at http://alok.stormpages.com

        T K 2 Replies Last reply
        0
        • S SiddharthAtw

          Yes. this is should be the first choice, even before MSDN. Rather microsoft should trigger it with F1.:laugh::laugh::laugh:

          2 Offline
          2 Offline
          224917
          wrote on last edited by
          #7

          Thats sounds nice, to have F1 shortcut to codeproject.;)


          greatest thing is to do wot others think you cant
          suhredayan@omniquad.com

          messenger :suhredayan@hotmail.com

          T 1 Reply Last reply
          0
          • T ThatsAlok

            USE THIS #define ID_timer 1000 use add window handler to deliver window message WM_TIMER OnTimer SetTimer(ID_timer,1000*60,NULL); to end timer KillTimer(ID_timer); Alok Gupta visit me at http://alok.stormpages.com

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

            hey Mr Alok, you mustn't call KillTimer() otherwise the timer associated function will be call once whereas it has to call and call each 60 second indefinitely... besides that, you post repeats the ones ever posted, thank you very much ! Has somebody told here, let us sleep :zzz::zzz::zzz:


            TOXCCT >>> GEII power

            D 1 Reply Last reply
            0
            • T toxcct

              hey Mr Alok, you mustn't call KillTimer() otherwise the timer associated function will be call once whereas it has to call and call each 60 second indefinitely... besides that, you post repeats the ones ever posted, thank you very much ! Has somebody told here, let us sleep :zzz::zzz::zzz:


              TOXCCT >>> GEII power

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

              What are you saying? When a timer is no longer needed, of course KillTimer() should be called. Even though a few WM_TIMER messages may still be in the queue, the message-handling function can react accordingly.


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

              T 1 Reply Last reply
              0
              • D David Crow

                What are you saying? When a timer is no longer needed, of course KillTimer() should be called. Even though a few WM_TIMER messages may still be in the queue, the message-handling function can react accordingly.


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

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

                yes, but Alok seems to calls KillTimer() at the end of OnTimer() :( Maybe i'm wrong, but that's not clear...


                TOXCCT >>> GEII power

                D 1 Reply Last reply
                0
                • 2 224917

                  Thats sounds nice, to have F1 shortcut to codeproject.;)


                  greatest thing is to do wot others think you cant
                  suhredayan@omniquad.com

                  messenger :suhredayan@hotmail.com

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

                  download the CodeProject ToolBar so... :-D


                  TOXCCT >>> GEII power

                  1 Reply Last reply
                  0
                  • T toxcct

                    yes, but Alok seems to calls KillTimer() at the end of OnTimer() :( Maybe i'm wrong, but that's not clear...


                    TOXCCT >>> GEII power

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

                    toxcct wrote: Maybe i'm wrong, but that's not clear... While he could have highlighted the code and text better so that they did not appear to be one, I think he was just showing how to start a timer, and then how to stop a timer.


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

                    T 1 Reply Last reply
                    0
                    • T ThatsAlok

                      USE THIS #define ID_timer 1000 use add window handler to deliver window message WM_TIMER OnTimer SetTimer(ID_timer,1000*60,NULL); to end timer KillTimer(ID_timer); Alok Gupta visit me at http://alok.stormpages.com

                      K Offline
                      K Offline
                      Keylee717
                      wrote on last edited by
                      #13

                      How about in C++?

                      T 1 Reply Last reply
                      0
                      • K Keylee717

                        How about in C++?

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

                        hey man, go sleeping, of course we're speaking about C++ !!! :zzz::zzz:


                        TOXCCT >>> GEII power

                        1 Reply Last reply
                        0
                        • D David Crow

                          toxcct wrote: Maybe i'm wrong, but that's not clear... While he could have highlighted the code and text better so that they did not appear to be one, I think he was just showing how to start a timer, and then how to stop a timer.


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

                          T Offline
                          T Offline
                          ThatsAlok
                          wrote on last edited by
                          #15

                          you are right buddy i am showing how to start a one minute timer and stop it to help him/her to understand problem:) Alok Gupta visit me at http://alok.stormpages.com

                          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