I'm trying to call my C# dll from a C++ client, so far I have the dll all setup and in my registry (I can create and call it from the power shell for example).
The problem I'm having is that I can't call it from my C++ code.
My C# interface:
namespace MyInterop
{
[Guid("BE507380-1997-4BC0-AF01-EE5D3D537E6B"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IMyDotNetInterface
{
void ShowCOMDialog();
}
}
My C# class that implements the interface:
namespace MyInterop
{
[Guid("38939B1E-461C-4825-80BB-725DC7A88836"), ClassInterface(ClassInterfaceType.None)]
public class MyDotNetClass : IMyDotNetInterface
{
public MyDotNetClass()
{ }
public void ShowCOMDialog()
{
MessageBox.Show("I am a" +
" Managed DotNET C# COM Object Dialog");
}
}
}
Very simple as I'm just testing at the moment. I now import the tlb into my C++ file
#import "<Path to file>\MyInterop.tlb" raw_interfaces_only
Finally I try to call it:
HRESULT hr = CoInitialize(NULL);
MyInterop::IMyDotNetInterfacePtr MyDotNetClass(__uuidof(MyInterop::MyDotNetClass));
MyDotNetClass->ShowCOMDialog();
CoUninitialize();
But, VS is telling me that ShowCOMDialog is not a member of my interface. Have I missed something?