Hosting .NET Control that uses Invoke in ActiveX Container

  • Thread starter Janiek Buysrogge
  • Start date
J

Janiek Buysrogge

Hello,

I've written a Windows Forms application in .NET 2.0 and am exposing
it to COM using the checkbox in Project Properties and by adding some
register functions and adding it to the GAC. I'm using the ActiveX
Test Container (tstcon32.exe) and I'm able to add the control to the
container. All this works, well almost... I'm using some Invoke calls
from worker threads that update the GUI. In native .NET this means
that stuff is done on the GUI thread, which is accessed by using a
pointer to the parent window. Of course, in a container we don't have
such a thing. My initial thought was to use the HWnd pointer of the
Container window and I can find this value my looking up
CurrentProcess and all. But how do I couple that value to the Invoke
call ? Maybe this is not the recommended way...

Any thoughts ?

Regards,

Janiek
 
J

Janiek Buysrogge

Hi guys,

Found the mistake. I attached event handlers to the worker threads in
my GUI constructor. In a .NET application this went well, however in
an ActiveX container this went wrong. I simply moved the event handler
attachments to the control's Load() event. This seems to work.

Greets,

JB
 

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