Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2005

Tip: Looking for answers? Try searching our database.

ActiveX control, disposing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EggHead - 18 Mar 2005 19:19 GMT
Hi all,

I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

Thank you all in advance :)

Egghead
Fruber Malcome - 19 Mar 2005 04:33 GMT
Have you tried:
GC.Collect()
GC.WaitForPendingFinalizers()

Performing this twice in a row - just to-be sure?

thanks - Fruber

 Hi all,

 I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

 But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

 Thank you all in advance :)

 Egghead
Egghead - 19 Mar 2005 14:34 GMT
Hi,

yes, the whole nine yards

remove the activeX control
dispose it
call GC
do event
dispose the sub form that has the ActiveX
call GC again
do event

The funny thing is that  I do not get the"exception privileged error" when I close the sub form. It happens when I close the main form. Also, I add the error handleing for Unhandled Exceptions in the main form as well.

Anyway, I find out why. I have an orphan pointer inside the ActiveX.

Egghead
 Have you tried:
 GC.Collect()
 GC.WaitForPendingFinalizers()

 Performing this twice in a row - just to-be sure?

 thanks - Fruber

   "EggHead" <robertlo@shaw.ca> wrote in message news:EYE_d.715110$6l.312054@pd7tw2no...
   Hi all,

   I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

   But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

   Thank you all in advance :)

   Egghead
Scott M. - 19 Mar 2005 16:51 GMT
Are you calling:
System.Runtime.InteropServices.Marshal.ReleaseComObject(comObj) in addition
to removing the managed references to the com object?

 Hi all,

 I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

 But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

 Thank you all in advance :)

 Egghead
Egghead - 21 Mar 2005 00:00 GMT
Hi,

I try that, it does not work at all.

Egghead
 Are you calling:
 System.Runtime.InteropServices.Marshal.ReleaseComObject(comObj) in addition
 to removing the managed references to the com object?

   "EggHead" <robertlo@shaw.ca> wrote in message news:EYE_d.715110$6l.312054@pd7tw2no...
   Hi all,

   I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

   But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

   Thank you all in advance :)

   Egghead
EggHead - 30 Mar 2005 20:38 GMT
Hi

I forget to add, it throws an exception "specified case is not valid".

my codes like this:

'it is the same with all the methods
Friend WithEvents AxMYACT1 As AxMYACT_ActiveX.AxMYACT or Dim AxMYACT1 As New AxMYACT_ActiveX.AxMYACT or  Dim AxMYACT1 As Object

'''
' do my stuff
'''

'than release
Try
   System.Runtime.InteropServices.Marshal.ReleaseComObject(Me.AxMYACT1 ) 'it throws an exception "specified case is not valid"
Catch ex As Exception
    System.Windows.Forms.MessageBox.Show(ex.Message)
Finally
   Me.AxMYACT1 .Dispose()
   Me.AxMYACT1  = Nothing
End Try

How can I call the release without the exception?

Thanks
 Hi,

 I try that, it does not work at all.

 Egghead
   "Scott M." <NoSpam@NoSpam.com> wrote in message news:uuuN4uJLFHA.440@TK2MSFTNGP10.phx.gbl...
   Are you calling:
   System.Runtime.InteropServices.Marshal.ReleaseComObject(comObj) in addition
   to removing the managed references to the com object?

     "EggHead" <robertlo@shaw.ca> wrote in message news:EYE_d.715110$6l.312054@pd7tw2no...
     Hi all,

     I am trying to put a Vb6.0 activeX control into a VB.net project. The Vb 6.0 activeX control works fine in a VB6.0 app.

     But the problem comes when I close down the Vb.net app. I get the"exception privileged error".  I think it is because the ActiveX components are not shut down in the necessary order when the application ends. I already call dispose and set the control to nothing. So, is there a way to force the activeX control unload all dll and component?

     Thank you all in advance :)

     Egghead
Grant_Aust - 21 Mar 2005 00:53 GMT
EggHead, I had the same problem with the AxWebBrowser control, in fact I still have the problem.   I discovered that it only happens on my Laptop and Home PC.   I tried a couple of other machines at my work, and the app closed with no problem.   I think it is a conflict with Visual Studio.

Grant.
EggHead - 21 Mar 2005 16:30 GMT
If it is not your own ActiveX ctl or you do not have access to the source code, it is extreme hard to debug. In my case, I find an orphan pointer inside one of my ActiveX ctl's supporting dll. It takes me 1-1/2 day :) The bug only happens when I am doing something with the ActiveX ctl. The app closed with no problem when I only loaded the ActiveX ctl with my .Net app.
Anyway, may be one of the ActiveX WebBrowser control's dll get fix in those no problem PC

Egghead
 EggHead, I had the same problem with the AxWebBrowser control, in fact I still have the problem.   I discovered that it only happens on my Laptop and Home PC.   I tried a couple of other machines at my work, and the app closed with no problem.   I think it is a conflict with Visual Studio.

 Grant.
Egghead - 24 Mar 2005 05:12 GMT
Hi Grant,

I have your problem with my ActiveX ctl this morning. It takes me 1/2 day to fix that, and I think you are right. Something wrong with the VS 's wrapper class. Anyway, it is the clock different in my PC and my client PC. I accidentally set my PC clock to April 23,2005 (therefore, my activeX's time stamp is April 23,2005), and my client PC has the right date.

Egghead

 If it is not your own ActiveX ctl or you do not have access to the source code, it is extreme hard to debug. In my case, I find an orphan pointer inside one of my ActiveX ctl's supporting dll. It takes me 1-1/2 day :) The bug only happens when I am doing something with the ActiveX ctl. The app closed with no problem when I only loaded the ActiveX ctl with my .Net app.
 Anyway, may be one of the ActiveX WebBrowser control's dll get fix in those no problem PC

 Egghead
   "Grant_Aust" <news-i-dont-like-spam@carthew.net> wrote in message news:OXcBFgaLFHA.3336@TK2MSFTNGP10.phx.gbl...
   EggHead, I had the same problem with the AxWebBrowser control, in fact I still have the problem.   I discovered that it only happens on my Laptop and Home PC.   I tried a couple of other machines at my work, and the app closed with no problem.   I think it is a conflict with Visual Studio.

   Grant.
Grant_Aust - 29 Mar 2005 05:02 GMT
Ok, thanks EggHead.   It's not a time problem with the WebBrowser control.
I am not trying to fix it now.   I just put up with the problem on my machine's knowing that it does not happen on my clients.

Regards

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.