HighTechTalks DotNet Forums  

How to unload an assembly from OCX?

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss How to unload an assembly from OCX? in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jim
 
Posts: n/a

Default How to unload an assembly from OCX? - 08-20-2007 , 03:57 PM






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_2...rk-interop.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Reply With Quote
  #2  
Old   
Jim Zhang
 
Posts: n/a

Default Re: How to unload an assembly from OCX? - 08-22-2007 , 04:26 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)?


*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #3  
Old   
Jim Zhang
 
Posts: n/a

Default Re: How to unload an assembly from OCX? - 08-22-2007 , 04:28 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)?



*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.