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. Please Help me !!

Please Help me !!

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 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.
  • L Offline
    L Offline
    Le rner
    wrote on last edited by
    #1

    Hi all, In my application ,on fromview i m using a List, to fill the list i m using number of function on OnInitialUpdate() Function. when list fill than the mouse cursor is in wait mode and application looks like hang. i want to add any dilog box/message box without any button it inform the status or message like Please wait, and other processing continue in background. when list is filled the dilog box/message box closed automatically. please can anybody help me for this. thank in advance.

    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

    R 1 Reply Last reply
    0
    • L Le rner

      Hi all, In my application ,on fromview i m using a List, to fill the list i m using number of function on OnInitialUpdate() Function. when list fill than the mouse cursor is in wait mode and application looks like hang. i want to add any dilog box/message box without any button it inform the status or message like Please wait, and other processing continue in background. when list is filled the dilog box/message box closed automatically. please can anybody help me for this. thank in advance.

      IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

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

      "_$h@nky_" wrote:

      when list fill than the mouse cursor is in wait mode and application looks like hang.

      Gather the information supposed to be displayed in the list box in a secondary thread while you have one item in the list saying something like "Updating..." or similar. When the thread has finished building a e.g. std::list with the elements for the list box, you walk through the list and add the elements to it. This way the application becomes responsive right away, but you inform the user that there is more data to be displayed in a while.

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

      L 1 Reply Last reply
      0
      • R Roger Stoltz

        "_$h@nky_" wrote:

        when list fill than the mouse cursor is in wait mode and application looks like hang.

        Gather the information supposed to be displayed in the list box in a secondary thread while you have one item in the list saying something like "Updating..." or similar. When the thread has finished building a e.g. std::list with the elements for the list box, you walk through the list and add the elements to it. This way the application becomes responsive right away, but you inform the user that there is more data to be displayed in a while.

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

        L Offline
        L Offline
        Le rner
        wrote on last edited by
        #3

        But i m using a ListCtrl,because i need a type of ReportView List.

        IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

        R 1 Reply Last reply
        0
        • L Le rner

          But i m using a ListCtrl,because i need a type of ReportView List.

          IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

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

          "_$h@nky_" wrote:

          But i m using a ListCtrl,because i need a type of ReportView List.

          The same mind set applies: prepare and format the data in a secondary thread before updating the UI element to make the UI updating process as fast as possible in order to have the application remain responsive.

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

          L 1 Reply Last reply
          0
          • R Roger Stoltz

            "_$h@nky_" wrote:

            But i m using a ListCtrl,because i need a type of ReportView List.

            The same mind set applies: prepare and format the data in a secondary thread before updating the UI element to make the UI updating process as fast as possible in order to have the application remain responsive.

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

            L Offline
            L Offline
            Le rner
            wrote on last edited by
            #5

            Can you please explain me with any example. thnks alot.

            IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

            R 1 Reply Last reply
            0
            • L Le rner

              Can you please explain me with any example. thnks alot.

              IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

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

              "_$h@nky_" wrote:

              Can you please explain me with any example.

              No. This is mainly a design issue, for which I have suggested a solution. How to implement this design is for you to figure out, which shouldn't be too hard. If you have more specific questions in the nature of "how do I tell my main thread when the computation has finished", I'll be glad to answer them. But serving it on a silver plate would prevent you from learning and besides I don't have the time to do it. To give you an idea I suggest you read this article[^] regarding worker threads. It's the best in my opinion.

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

              K 1 Reply Last reply
              0
              • R Roger Stoltz

                "_$h@nky_" wrote:

                Can you please explain me with any example.

                No. This is mainly a design issue, for which I have suggested a solution. How to implement this design is for you to figure out, which shouldn't be too hard. If you have more specific questions in the nature of "how do I tell my main thread when the computation has finished", I'll be glad to answer them. But serving it on a silver plate would prevent you from learning and besides I don't have the time to do it. To give you an idea I suggest you read this article[^] regarding worker threads. It's the best in my opinion.

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

                K Offline
                K Offline
                kingori
                wrote on last edited by
                #7

                hi , maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread. i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion. so this is what we shall do, i hope you can tell the number of items you are putting in the list, Put a progress control , Add a control variable to it, call it "m_ctlProgress" using the wizard. ////////////////////// int nCounter = 0; int nNumberOfRecords = ctlProgress.SetRange(0,nNumberOfRecords ); for { ////////////////////////// Your filling code here ///////////////////////// nCounter++; m_ctlProgress.SetPos(nCounter); } then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc

                R 1 Reply Last reply
                0
                • K kingori

                  hi , maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread. i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion. so this is what we shall do, i hope you can tell the number of items you are putting in the list, Put a progress control , Add a control variable to it, call it "m_ctlProgress" using the wizard. ////////////////////// int nCounter = 0; int nNumberOfRecords = ctlProgress.SetRange(0,nNumberOfRecords ); for { ////////////////////////// Your filling code here ///////////////////////// nCounter++; m_ctlProgress.SetPos(nCounter); } then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc

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

                  :zzz: Some hints...:

                  1. You replied to the wrong person.
                  2. The function you're referring to is OnInitialUpdate(), nothing else.
                  3. OnInitialUpdate() is called before the view is displayed, which means that your progress bar probably won't even show if your code is called from OnInitialUpdate().
                  4. You have not formatted your code using <pre></pre> tags, which makes it hard to read.
                  5. At best, the user will still experience a non-responsive application even if your advice is followed.

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

                  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