Board index » cppbuilder » Using BCB6 ActiveX component in .Net giving error when closing

Using BCB6 ActiveX component in .Net giving error when closing

Gentlemen,

This might not be the correct area for the post but I was wondering if
anyone has any experience with using a BCB6 ActiveX component under the .Net
platform.  I have a component that uses a datamodule to isolate a Client
socket and whenever the .Net app closes it appears that the proper shutdown
is not being done, it never makes it to the datamodule OnDestroy or the
destructor method of the component.  Can anyone point me to some information
that might help in solving this?

Thanks,

Tim

 

Re:Using BCB6 ActiveX component in .Net giving error when closing


It may be due to the lack of deterministic finalization, although I would
have thought the WinForms framework would take care of this for ActiveX
controls.

Take a look at the MSDN documentation for 'ReleaseComObject'.

You commonly need to use this when using COM objects from .NET, in order to
ensure the COM object is released at an appropriate time.

I'm unsure however, why you're not getting the OnDestroy event - the garbage
collector should release your COM object automatically on shutdown.

One thing you may want to try, is add a destructor to your class and check
with your de{*word*81} that the destructor is being called.  This will tell you
if the problem is that your component isn't being released correctly, or if
you have some other issue.

Phil.

Quote
"Tim Martin" <tmar...@commandalkon.com> wrote in message

news:3ded1978$1@newsgroups.borland.com...
Quote
> Gentlemen,

> This might not be the correct area for the post but I was wondering if
> anyone has any experience with using a BCB6 ActiveX component under the
.Net
> platform.  I have a component that uses a datamodule to isolate a Client
> socket and whenever the .Net app closes it appears that the proper
shutdown
> is not being done, it never makes it to the datamodule OnDestroy or the
> destructor method of the component.  Can anyone point me to some
information
> that might help in solving this?

> Thanks,

> Tim

Re:Using BCB6 ActiveX component in .Net giving error when closing


Thanks for the response..

I have already added the Destructor and put a break point within and the
error is happening before either event fires.  The error looks like it is
trying to access an invalid method on the COM interface.  I will investigate
the MSDN docs.

Any other ideas are appreciated..

Thanks,

Tim

Quote
"Phil Parker" <par...@sensormatic.com> wrote in message

news:3dee3d6e$1@newsgroups.borland.com...
Quote
> It may be due to the lack of deterministic finalization, although I would
> have thought the WinForms framework would take care of this for ActiveX
> controls.

> Take a look at the MSDN documentation for 'ReleaseComObject'.

> You commonly need to use this when using COM objects from .NET, in order
to
> ensure the COM object is released at an appropriate time.

> I'm unsure however, why you're not getting the OnDestroy event - the
garbage
> collector should release your COM object automatically on shutdown.

> One thing you may want to try, is add a destructor to your class and check
> with your de{*word*81} that the destructor is being called.  This will tell
you
> if the problem is that your component isn't being released correctly, or
if
> you have some other issue.

> Phil.

> "Tim Martin" <tmar...@commandalkon.com> wrote in message
> news:3ded1978$1@newsgroups.borland.com...
> > Gentlemen,

> > This might not be the correct area for the post but I was wondering if
> > anyone has any experience with using a BCB6 ActiveX component under the
> .Net
> > platform.  I have a component that uses a datamodule to isolate a Client
> > socket and whenever the .Net app closes it appears that the proper
> shutdown
> > is not being done, it never makes it to the datamodule OnDestroy or the
> > destructor method of the component.  Can anyone point me to some
> information
> > that might help in solving this?

> > Thanks,

> > Tim

Other Threads