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