In COM, when calling an object in STA from another
apartment, COM will marshall the call across apartments.
Tom, are you saying that .NET uses COM underneath to
marshall calls from free-threaded apartment to STA where
the UI elements reside? Essentially, calling Invoke(),
makes sure that the correct thread manages the UI element
even though a worker thread also has the UI element's
handle?
>-----Original Message-----
>> On a similar subject, I've had problems with Invoke() locking up -
[quoted text clipped - 5 lines]
>
>.
Thomas Tomicek [MVP] - 11 Sep 2003 14:45 GMT
> In COM, when calling an object in STA from another
> apartment, COM will marshall the call across apartments.
[quoted text clipped - 4 lines]
> even though a worker thread also has the UI element's
> handle?
Naturally there sis a COM threading model below. How else could it accept
ActiveX controls on a form without problems?
The documentation is clear: you are supposed to invoke and thus marshal back
to the UI thread.
This, though, has nothing to do with COM, btw- the threading model was IMHO
there before COM came around.

Signature
Regards
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)