I opened this new discussion especially for Geert_Gruwez, about his article of:
So, lets continue the talk here, as the admin stated we need to open a new topic about this instead of continueing it in the other one.
so, as you saw, i store each thread's personal handle to the TProgressBar in an array of TProgressBar.
how many progress bars are being created at run time ? that's the user choice, using SetLength on the array.
so you said something like:
"your form needs to know what thread is corresponding to what progressbar
what are you using to start the multiple threads ?
at the time you start the threads, i imagine you are creating just as many progressbars ?
ah here :
alabel[nLoop], apbar[nLoop], hOpenFile[nLoop], hInetFile[nLoop], i64Start, i64End ) do
Priority := tpNormal;
you basically pass the progressbar to the thread
but ... it would be better if you pass this variable to the routine in the callback
sample callback :"
TProgressCallback = procedure (Sender: TObject; aProgress: TObject; aProcent: Integer);
and in your form:
procedure TFormxXXX.ThreadProgress(Sender: TObject; aProgress: TObject; aProcent: Integer);
// Assuming min = 0 and Max = 100
TProgressBar(AProgress).Position := aProcent;