using COM from VC (either managed or unmanaged)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Bonj (Bonj_at_discussions.microsoft.com)
Date: 10/09/04


Date: Sat, 9 Oct 2004 12:49:07 -0700

Hello
I have a problem with creating a COM object from C++.
The COM object is called, say, My3rdPartyDLL.MyCOMObject.
When I do it from unmanaged C++, with smart pointers, the DLL gets #imported
fine and it compiles OK. But when it gets to it, it has an unhandled
(unhandleable?) exception which pops up with the message 'User breakpoint
called', even with try..catch round it.
This is when using the syntax
My3rdPartyDLL::_MyCOMObjectPtr myobj(__uuidof(My3rdPartyDLL::MyCOMObject));
or
My3rdPartyDLL::_MyCOMObjectPtr myobj;
myobj.CreateInstance(__uuidof(My3rdPartyDLL::MyCOMObject));

When I try and do it from managed code, using
My3rdPartyDLL::MyCOMObjectClass* myobj = __gc new
My3rdPartyDLL::MyCOMObjectClass();

it does the same thing, and still a try..catch fails to handle the exception.

This COM object is protected with a dongle, but the dongle is definitely
plugged in.
The weird thing is that this method works fine on other COM objects, like a
sample one I knocked up to emulate it in VB6.
The protected COM object that I want to use also works fine from C# or VB6.
Why won't it work from ANY variety of C++ then?

Any help much appreciated

Cheers



Relevant Pages

  • using COM from VC (either managed or unmanaged)
    ... When I do it from unmanaged C++, with smart pointers, the DLL gets #imported ... and still a try..catch fails to handle the exception. ... This COM object is protected with a dongle, ... The protected COM object that I want to use also works fine from C# or VB6. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: ExecutionEngineException in dotnet 2.0 application doing interop with VB6 legacy code
    ... all CLR exceptions use the SEH exception code e0434f4d - this is more of an historical holdover than an indication that the exception is related to COM. ... It is still a little weird that the ExecutionEngineException seems to have been the result of "just" a resource leak. ... it appears to have something to do with us not closing our database connections to sql express explicitly. ... has 800KLOC of VB6 code. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: ExecutionEngineException in dotnet 2.0 application doing interop with VB6 legacy code
    ... all CLR exceptions use the SEH exception code e0434f4d - this is more of an historical holdover than an indication that the exception is related to COM. ... It is still a little weird that the ExecutionEngineException seems to have been the result of "just" a resource leak. ... it appears to have something to do with us not closing our database connections to sql express explicitly. ... has 800KLOC of VB6 code. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: On Error Resume Next equllance in VB.NET?
    ... First, the "On Error Resume Next" statement doesn't work with ADO, even in ... VB6. ... you really need to find the error and fix it. ... > it through Exception Like This. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: using COM from VC (either managed or unmanaged)
    ... "Bonj" wrote: ... > fine and it compiles OK. ... > This COM object is protected with a dongle, ... > sample one I knocked up to emulate it in VB6. ...
    (microsoft.public.dotnet.languages.vc)