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. Updating a list box w/ progress data

Updating a list box w/ progress data

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpannouncement
2 Posts 2 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.
  • J Offline
    J Offline
    jimNLX
    wrote on last edited by
    #1

    I'm trying to use a list box to add strings to let the user know the progress of the function being executed. So I've added a string before the function and one after (start/complete), but both strings don't update to the box until after the function is completed. How can I get these message to update in a timely fashion? Thanks for the help

    D 1 Reply Last reply
    0
    • J jimNLX

      I'm trying to use a list box to add strings to let the user know the progress of the function being executed. So I've added a string before the function and one after (start/complete), but both strings don't update to the box until after the function is completed. How can I get these message to update in a timely fashion? Thanks for the help

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

      Your "processing" loop is not yielding enough CPU time such that the WM_PAINT messages can be processed. In other words, you've got something like:

      while (some_condition)
      {
      do some processing
      update listbox
      }

      // not until this point do the items appear in the listbox

      This is a prime candidate for a UI thread (i.e., thread with message pump). In your app's primary thread will be the listbox. When processing starts, create another thread to handle the processing. That thread will post (not send) messages back to the primary thread with items to be added to the listbox. Check out these articles: http://flounder.com/uithreads.htm http://flounder.com/workerthreads.htm


      Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

      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