I am trying to write a C # component that will expose events. The component must be imported by an unmanaged C ++ application. According to several tutorials, I came up with this code (for the C # side):
namespace COMTest { [ComVisible(true), Guid("02271CDF-BDB9-4cfe-B65B-2FA58FF1F64B"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface ITestEvents { void OnTest(); } [ComVisible(true), Guid("87BA4D3A-868E-4233-A324-30035154F8A4")] public interface ITest { void RaiseTest(); }
Now my C ++ code has an easy way:
#import "COMTest.tlb" named_guids raw_interfaces_only
Creates a tlh file. This tlh file contains everything except my event (OnTest). What am I doing wrong?
source share