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. Progress and Timer

Progress and Timer

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

    I just post a message about this question Link but I don't obtain a good answer... I need to manage a Progress Bar created into my man app from a thread (while my app is using an ActiveX control). How can I do this? I must use a timer to increment the progress, but I can't use the CWnd::setTimer why my CThread class is derived from CWinThread an not from Cwnd, so how can I manage the Timer? Thanks for every observation.

    CPalliniC 1 Reply Last reply
    0
    • C CDRAIN

      I just post a message about this question Link but I don't obtain a good answer... I need to manage a Progress Bar created into my man app from a thread (while my app is using an ActiveX control). How can I do this? I must use a timer to increment the progress, but I can't use the CWnd::setTimer why my CThread class is derived from CWinThread an not from Cwnd, so how can I manage the Timer? Thanks for every observation.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Well, you can use SetTimer function of global namespace (passing NULL as HWND and a valid callback function pointer). But then, how do you communicate with the progress bar? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

      In testa che avete, signor di Ceprano?

      C 1 Reply Last reply
      0
      • CPalliniC CPallini

        Well, you can use SetTimer function of global namespace (passing NULL as HWND and a valid callback function pointer). But then, how do you communicate with the progress bar? :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

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

        Thanks for the reply, I use SetTimer function you said but now my main problem is just how to comunicate with the pregress?? It's a global variable of my app, but can I access and use it from the thread? It's seems NO because nothing is performed by code that must increment it!! SO HOW DO THIS?

        CPalliniC 1 Reply Last reply
        0
        • C CDRAIN

          Thanks for the reply, I use SetTimer function you said but now my main problem is just how to comunicate with the pregress?? It's a global variable of my app, but can I access and use it from the thread? It's seems NO because nothing is performed by code that must increment it!! SO HOW DO THIS?

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          I suggest to you to post a message to the Application Window Thread (you can pass the application window HANDLE to your secondary thread whenever you create it) and let it (the Application Window Thread) do the updating job for you. P.S. Maybe the overall design is wrong: probably would be better to create a window in the secondary thread and build the progress bar in that context. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

          In testa che avete, signor di Ceprano?

          L 1 Reply Last reply
          0
          • CPalliniC CPallini

            I suggest to you to post a message to the Application Window Thread (you can pass the application window HANDLE to your secondary thread whenever you create it) and let it (the Application Window Thread) do the updating job for you. P.S. Maybe the overall design is wrong: probably would be better to create a window in the secondary thread and build the progress bar in that context. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

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

            Or you could use a simple Object Oriented solution like this[^] :rolleyes:

            led mike

            CPalliniC R 2 Replies Last reply
            0
            • L led mike

              Or you could use a simple Object Oriented solution like this[^] :rolleyes:

              led mike

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              Oh, I see..., he is going round and around forums to remain stick in his original design... :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

              In testa che avete, signor di Ceprano?

              C 1 Reply Last reply
              0
              • CPalliniC CPallini

                Oh, I see..., he is going round and around forums to remain stick in his original design... :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

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

                I try to explain well my problem.. In my MainWnd I use an ActiveX control (a REprot Viewer) that need time to compute his job (load report) and I need the increment the progress bar while it's computing. I can't set a timer to update the progress bar in the MainWnd (as said here) because while the activeX is working the Timer event is not processed. If the solution you suggest work, I don't need the MyThread but I can manage directly the progress in the MainWnd, but it's wrong. I hope to explain well my problem, and because I use this solution. Thanks

                M 1 Reply Last reply
                0
                • L led mike

                  Or you could use a simple Object Oriented solution like this[^] :rolleyes:

                  led mike

                  R Offline
                  R Offline
                  Roger Stoltz
                  wrote on last edited by
                  #8

                  It all started here[^].


                  "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                  "High speed never compensates for wrong direction!" - unknown

                  C 1 Reply Last reply
                  0
                  • R Roger Stoltz

                    It all started here[^].


                    "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                    "High speed never compensates for wrong direction!" - unknown

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

                    Thanks a lot for the reply, I just see your past reply but I will see if somebody can give me a solution for don't use another dialog (with progressbar).

                    1 Reply Last reply
                    0
                    • C CDRAIN

                      I try to explain well my problem.. In my MainWnd I use an ActiveX control (a REprot Viewer) that need time to compute his job (load report) and I need the increment the progress bar while it's computing. I can't set a timer to update the progress bar in the MainWnd (as said here) because while the activeX is working the Timer event is not processed. If the solution you suggest work, I don't need the MyThread but I can manage directly the progress in the MainWnd, but it's wrong. I hope to explain well my problem, and because I use this solution. Thanks

                      M Offline
                      M Offline
                      Mark Salsbery
                      wrote on last edited by
                      #10

                      I'm totally lost (or you are :)) (I've been following all the threads on this topic). If your ActiveX control is busy processing stuff on the app's main thread, and your progress dialog/control was created on that same thread, then the progress dlg/control cannot process any window messages because your activex control has control of the thread so the thread's message loop isn't being processed. So, it seems to me you have two options - 1) Put the activeX control on another thread so the main thread can process window messages as usual (it can also process your timer messages) 2) Put the progress dialog on a separate thread and process all it's messages, including timer messages, on that thread. That way the ActiveX control can go about its business. Both these have been recommended to you several times. Try one! :) Mark

                      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                      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