![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Slowly losing my mind on this one. May be an extremely simple answer, but I have no idea what it is. I have a C++ COM object - let's say MyCalcs that implements IMyInterface. And Let's say they exist in MyComponent.Dll. Now I add a reference to MyComponent.Dll in VS2008 (C#). In my code I do: "MYCOMPONENTLib.IMyInterface myInterface = new MYCOMPONENTLib.MyCalcs" and then attempt to invoke "myInterface.DoStuff()". When I attempt to invoke the method .DoStuff() I receive an error: "Unable to cast COM object of type MYCOMPONENTLib.MyCalcs' to interface type MYCOMPONENTLib.IMyInterface'. This operation failed because the QueryInterface call on the COM component....failed due to the following error: No such interface supported". I also receive the same error message if I attempt to instantiate MyCalcs as the object and invoke .DoStuff() directly on it. Ok - that seems like a pretty straight forward error message. Except MyCalcs *does* support IMyInterface. The object browser in VS2008 seems fully aware of this. So does intellisense. Also, if I step back into the COM world I can instantiate IMyInterface and invoke the .DoStuff() method in Visual C++ using CoCreateInstance() and QueryInterface(). So it seems to me that proves the COM component itself functions just fine. That seems to imply something is wrong with the way I'm interop'ing to the component. But I have absolutely no idea what it could be. Anyone out there ever seen something similar? Thanks! |
#3
| |||
| |||
|
|
Slowly losing my mind on this one. May be an extremely simple answer, but I have no idea what it is. I have a C++ COM object - let's say MyCalcs that implements IMyInterface. And Let's say they exist in MyComponent.Dll. Now I add a reference to MyComponent.Dll in VS2008 (C#). In my code I do: "MYCOMPONENTLib.IMyInterface myInterface = new MYCOMPONENTLib.MyCalcs" and then attempt to invoke "myInterface.DoStuff()". When I attempt to invoke the method .DoStuff() I receive an error: "Unable to cast COM object of type MYCOMPONENTLib.MyCalcs' to interface type MYCOMPONENTLib.IMyInterface'. This operation failed because the QueryInterface call on the COM component....failed due to the following error: No such interface supported". |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |