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. Thread and ON_WM_TIMER

Thread and ON_WM_TIMER

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

    Hi I need to manage a progressBar into MyThread class(CWinThread derived) using a timer but I can use the ON_WM_TIMER Event message. How can I do it? Using the SetTimer function but how? Thanks

    L D 2 Replies Last reply
    0
    • C CDRAIN

      Hi I need to manage a progressBar into MyThread class(CWinThread derived) using a timer but I can use the ON_WM_TIMER Event message. How can I do it? Using the SetTimer function but how? Thanks

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      CDRAIN wrote:

      How can I do it? Using the SetTimer function but how?

      They hide that information in the Documentation[^]

      led mike

      C 1 Reply Last reply
      0
      • C CDRAIN

        Hi I need to manage a progressBar into MyThread class(CWinThread derived) using a timer but I can use the ON_WM_TIMER Event message. How can I do it? Using the SetTimer function but how? Thanks

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

        CDRAIN wrote:

        Hi I need to manage a progressBar into MyThread class(CWinThread derived)...

        Does the progress bar belong to a different thread than the one you are creating?


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        C 1 Reply Last reply
        0
        • D David Crow

          CDRAIN wrote:

          Hi I need to manage a progressBar into MyThread class(CWinThread derived)...

          Does the progress bar belong to a different thread than the one you are creating?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          C Offline
          C Offline
          CDRAIN
          wrote on last edited by
          #4

          Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.

          D L 2 Replies Last reply
          0
          • L led mike

            CDRAIN wrote:

            How can I do it? Using the SetTimer function but how?

            They hide that information in the Documentation[^]

            led mike

            C Offline
            C Offline
            CDRAIN
            wrote on last edited by
            #5

            Sorry, I made an error on the description of my problem: I can't use the ON_WM_TIMER message because my class MyThread isn't derived from the CWnd but from the CWinThread. How can I do this?

            1 Reply Last reply
            0
            • C CDRAIN

              Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.

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

              CDRAIN wrote:

              Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.

              Which is a sure-fire recipe for disaster.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              1 Reply Last reply
              0
              • C CDRAIN

                Yes, the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.

                L Offline
                L Offline
                led mike
                wrote on last edited by
                #7

                CDRAIN wrote:

                the progress bar belong to the MainThread of my Application, and I need to manage it from my thread.

                in your first post you said

                CDRAIN wrote:

                I need to manage a progressBar into MyThread class

                I have no idea what to believe at this point. If your progress bar is in the main thread you DO NOT need to manage it from the worker thread. Instead you do something like this: Progress Information Object CWnd in main thread (Progress Bar or Window) has a reference to the Progress Information Object CWinThread worker thread has a reference to the Progress Information Object and continuously updates the object to reflect the work in progress. ProgressBar or Window sets a timer and on the timer event reads the progress information from the shared Progress Information Object and updates the ProgressBar state.

                led mike

                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