0
Answer

Implemeting the exisitng COM interface with C#

anil bagri

anil bagri

17y
1.7k
1
I need one help in Implementing the Existing C++ COM interface in my C# dll. I read your comments in internet and got the email id from there only. My requirement is like this. I have one interface IRFAppl in C++ COM dll and the same interface I need to use in C# dll. and after that I need to creat the object of C# class in another COM dll. What I did: I used the same Guid id if COM interface in my C# code like this C# code in Class1.cs [ComImport(), Guid("AE736E31-2D36-11D2-BF17-00C04FA3F436"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IRFAppl - this interface name is same as COM dll interface { IApplDevice pApplDevice { } void ProcessInput(ref RFMSGCODE MsgCode); string Hello(); string GoodBye(); IRFAppStat pAppStatObj { get; } } I am able to compile the program but getting the error when I tried to creat the object with C++ code in COM dll. hr = m_ptrRFAppl.CreateInstance(Anil.Class1); // Anil.Class1 - is the Prog_ID of C# class and interface if (FAILED(hr)) _com_issue_error(hr); the error is :- COM error: 80070002 The system cannot find the file specified.. It is working fine if I create dll in C++ instead if C#. Please help me to implemening the existing COM interface in C#.