Update Progressbar while other things a running.

Just starting out? Need help? Post your questions and find answers here.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Update Progressbar while other things a running.

Post by captain_skank »

Morning all, hope everyone is hale and hearty.

I have a program that, using compateplus, exports SQL query results to a spreadsheet and it all works as it should.

The problem is that it takes a long time to complete, and users are impatient so i'd like to display an animated something and thought a progress bar would do.

So i used a window timer event which is fine until i call my excel procedure and then nothing is updated.

I think i need a thread to update the progressbar ? but am unsure how to go about this because everything i've tried so far has no effect.

Anyone got any pointers on how to acheive this ?

cheers
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Update Progressbar while other things a running.

Post by Little John »

Hi!

The following works fine for me:
  • The "background job" is done in a thread.
  • Each time a piece of work is finished, the thread uses PostEvent() to tell the main program code about this.
  • When the main program code receives such an event, it updates the progressbar accordingly.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Update Progressbar while other things a running.

Post by captain_skank »

Thanks Little John, postevent() did the trick nicely.

I did away with the progress bar and now have a popup window with a animated 'busy' gif.
Post Reply