all groups > dotnet interop > august 2007 >
You're in the

dotnet interop

group:

How to unload an assembly from OCX?


How to unload an assembly from OCX? Jim
8/20/2007 12:57:06 PM
dotnet interop: I have an OCX which interop a C# assembly. C# assembly needs to callback OCX in a method by parameter pointing to this OCX.
It works in the first time load. If I reload OCX, OnInitDialog() won't be called and app is hanged on.
If I don't pass this OCX as parameter to the assembly, second time reload is ok.

Any thoughts?

From http://www.developmentnow.com/g/21_2007_8_0_0_0/dotnet-framework-interop.htm

Posted via DevelopmentNow.com Groups
Re: How to unload an assembly from OCX? Jim Zhang
8/22/2007 1:26:09 PM
The problem is that how to clean the COM object in assembly since this
is like two ways Interop.

If I use "ref object" parameter in assembly, I don't need to clean it in
assembly. After OCX is unloaded, it should go away with OCX.
But the host process is still there(OCX and assembly are leaving there
too?), when reloading OCX, OCX pointer should send to assembly again.
But don't know why OCX's constructor get called, then OCX get unloaded
(other OCX memory get corrupted)?


Re: How to unload an assembly from OCX? Jim Zhang
8/22/2007 1:28:14 PM
The problem is that how to clean the COM object in assembly since this
is like two ways Interop.

If I use "ref object" parameter in assembly, I don't need to clean it in
assembly. After OCX is unloaded, it should go away with OCX.
But the host process is still there(OCX and assembly are leaving there
too?), when reloading OCX, OCX pointer should send to assembly again.
But don't know why OCX's constructor get called, then OCX get unloaded
(other OCX memory get corrupted)?



AddThis Social Bookmark Button