It's known that, in cases when one needs comunicate between UI thread and working thread, an hidden window must be created because of thread safety(handle reconstruction).
For exemplify:
Form1
has N dynamicaly createdTProgressBar
instances with the same name of a background running .- Is always garanteed that
WM_REFRESH
will only be called inside Task Thread. Form1
hasH : THandle property
that allocates the following procedure:procedure RefreshStat(var Message: TMessage); message WM_REFRESH;
Inside
RefreshStat
, in cases when there is only 1 background thread I could easily useL
andW
parameter to map Task Id and position.
I don't know if the title says what I want to know, but let's imagine if we have an application that has multiple background tasks running.
In my case I use TProgressBar
to report progress the done.
Does AllocateHwnd
garantee that all messages arrives with no race condition the hidden window?
What happens if two or more tasks post the message at the same time?
If this needs to be controled manually, I wonder if there is something else to do besides creating another message loop system in the custom message.
I hope the question is clear enough.
progress bar messages
to the controls on your form. – TLama