Display a thread window while doing some work

I am trying to understand how thread dialogboxes work. In my application I do things which takes time to finish (processing images, downloading, etc). My problem is that when I do these things my whole application gets frozen. So, I know I need to launch a thread. I took a look on the demo project but still can’t figure how to do it.

For example, let’s say I have a function called downloadImage() and I want to show a thread window while the download function is running. How would I do it? An example would be perfect !!


The download function is like this:

void downloadImage(String url, String outfile, void (*progressCallback)(void*,double,double,double,double))

and progressCallback gets called on progress. So, I need to somehow also use this callback function to change the progress bar value of the thread window.

juce::ThreadWithProgressWindow class?