I'm doing a dll an object of which will be created by a COM host.
I've done all the interop stuff but now I want to display a Form and when someone presses a button of that form, I'll call host methods.
So the setup is this:
Com-Host executes VBScript
VBScript says set X = createobject("MyStuff")
And then X.check(HostObject) . X is implemented in C#. HostObject is the COM Host, a CAD tool.
So far so good.
In check(ViewDraw.IvdApplication App) I do a
MyForm G=new MyForm(App); G.Show();
What happens is that Show() returns immediately, I'm quickly back in VBScript but the form stays on the screen and is plainly usable.
On the other hand, if I display the thread id's while executing in
I always get the same thread id.
So, how does that work?
If I store App as a property of the form and, upon some buttonpress event, call methods like App.GetAllSchematicPages(), they'll still hit App out of the blue. Is that safe? The CAD program itself is definitely not thread safe.
Would I have to do some kind of producer-consumer queue for processing messages in the check(App) method?
I'm picturin something like: