Using a C# COM component from C++

Nov 1 2006 8:27 PM

Hi all,

I wrote a very simple user control in C#, and I'm trying to access it from my C++/MFC code. The control contains a single label in it. Here's the control code itself:

namespace HelloCom {

    [Guid("F0AE1BB2-A840-4341-B785-D8A54C81E643")]
    public interface HelloCom {
        
    }
    
    [Guid("111DCC11-900D-431c-B3A0-4B95C539A47D")]
    public partial class HelloComImpl : UserControl, HelloCom {
        public HelloComImpl() {
            InitializeComponent();
        }
    }
}

Here's what I've done so far:

  • Signed my control with a strong key
  • Clicked the "expose assembly to COM interop" and "make visible to COM" options
  • regasm HelloCom.dll /tlb:HelloCom.tlb
  • gacutil -i HelloCom.dll
However, despite all this, I still cannot see my control in the Toolbox on the C++ side, nor can I insert it via the "Insert ActiveX Control" menu option. What am I doing wrong ?


Answers (1)