Click to See Complete Forum and Search --> : Progress Bar problem


GameZelda
March 11th, 2008, 06:51 AM
I have a small problem. I need to extract the files from a container of 8GB, so I added a small progress bar to display the percentage.

The progress bar itself works, but when I minimize the window, I can't restore it until the extraction ends since the program is like "hanged".

How could I fix that?

LoKi_79
March 11th, 2008, 07:17 AM
the correct way is to use seperate threads for each task (i.e. copying the files) so that the main thread is free to update/redraw the windows.

another incorrect way is to add a small loop that uses ::PeekMessage() to remove, and then TranslateMessage() and DispatchMessage() to deal with all of your paint messages, for example between each file that is transfered.

LoKi_79
March 11th, 2008, 07:22 AM
here is a good link someone posted on another thread:
http://www.flounder.com/workerthreads.htm

Marc G
March 14th, 2008, 12:16 PM
another incorrect way is to add a small loop that uses ::PeekMessage() to remove, and then TranslateMessage() and DispatchMessage() to deal with all of your paint messages, for example between each file that is transfered.
There is nothing wrong with that method, however, I recommend threads for long operations and it seems this extraction is a very long operation.