I have a COM Callable Wrapper that I'm using from a VB6 program, but the program won't receive COM events unless the CCW is registered. Otherwise, the CCW works fine, just no events until I remove the program's manifest file and register the CCW using "regasm /tlb /codebase theccw.dll". This is in WinXP SP3.
What could be the problem?
Maybe my CCW is built wrong for use as an "early bound" VB6 object. Here are my declarations:
[ComVisible(false)]
public delegate void AnEventDelegate(int arg1);
[
ComVisible(true),
GuidAttribute("XXXX-XXXX-XXXX-XXXX"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)
]
public interface IComEvents
{
void AnEvent(int arg1);
}
[
ComVisible(true),
Guid("YYYY-YYYY-YYYY-YYYY"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(IComEvents))
]
public class TheComClass: IComContract
{
public TheComClass(){}
// Implicit implementation of IComContract.
// Implicit implementation of IComEvents.
//
// eg. public event AnEventDelegate AnEvent;
}
[
ComVisible(true),
Guid("ZZZZ-ZZZZ-ZZZZ-ZZZZ")
]
public interface IComContract
{
[ComVisible(true)]
string AProp{ get; set; }
[ComVisible(true)]
void AMethod();
}
One thing I just realized. I don't have [ComVisible(true)] attributes on my public event declarations inside of TheComClass. I don't think that's the problem because I do get the events when the thing is registered, but we'll see...