GUI Thread ComInterop

I

info

Hi

I've an C# .NET 2.0 Windows Forms Application which is placed in an
DLL.

This DLL is instanciated from an non .NET enviroment via ComInterop.
This works fine. but I need to put the wohle .NET Application in an
second thread so that both applicaitons .NET and non .NET are
responsive.

Now I create a thread via the static Thread class.
I've got an static FormHandler which create Forminstances via
Activator.CreateInstance.

Now I open the messagepump via Application.Run(new frmScreen());

When I now click somewhere inthe Menu of the form which calls the
static Method of the FormHandler i got a problem when assigning the
MDIParent to the new form .
The exception says that they where indifferent threads.
But how can that be ?

The Managed thread Id is the same and also the InvokeRequired
Propertie of the screen is right before createinstance false.

Is the problem that the Formhandler is static and so exists before the
second thread iscreated ? or is the problem in CreateInstance? I hope
you can give me any help
 
C

cbmeeks

Hi

I've an C# .NET 2.0 Windows Forms Application which is placed in an
DLL.

This DLL is instanciated from an non .NET enviroment via ComInterop.
This works fine. but I need to put the wohle .NET Application in an
second thread so that both applicaitons .NET and non .NET are
responsive.

Now I create a thread via the static Thread class.
I've got an static FormHandler which create Forminstances via
Activator.CreateInstance.
Check out BackGroundWorker in .NET 2.0

http://www.codershangout.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top