using COM from VC (either managed or unmanaged)

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top