Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to refresh a progress bar

Status
Not open for further replies.

joelwenzel

Programmer
Jun 28, 2002
448
Hello,

I have a progress bar control in my project that shows the progress of a bunch of file processing. It works fine if I don't touch anything while the program is processing files. However, if I click on something else, the progress bar stops refreshing until the file processing is completed. Is there some way to force it to refresh/repaint/redraw/etc?

Thanks
 
Unless you want to go into multithreading (see faq116-5162) and such, you could simply pump messages whenever you update the progressbar. Call a function like this whenever you call the progressbar's SetPos:
Code:
void pumpMessages()
{
	MSG msg;    
	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))      
	{
		TranslateMessage(&msg);         
		DispatchMessage(&msg);      
	}	
}

/Per

"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top