I'm trying to create a single interafce that can be implelment by either a
..Net class or a COM object. Here's what I'm tried to do. I defined an
interface using VB.net in an assembly all by itself. This interface has a
couple of simple procedures and 3 events. I created a test project in
VB.Net to test a class implementing the interface and everything works fine.
I'm now trying to get a COM object to implement this interface. I used the
TLBEXP utility to generate a type library that I can reference in a VB6
project. The main problem that I'm running into is that when the type
library was generated by TLBEXP, the events in the interface got converted
with underscroes in the name. VB6 is complaining about the undrescores. I
tried removing the events and generating a type library and it seemed to
work since there were no methods with underscores in the name. So I'm
trying to figure out what is the best way to define the interface in .Net so
that when the type library is created it can be used by VB6. I'm including
my .Net interface and the interface in the type library below.
Thanks,
Eric
Interface in VB.Net
Public Interface WizardInterface
Sub Init(ByVal bShowWelcomePage As Boolean)
Function NextPage() As Boolean
Function BackPage() As Boolean
Sub Show()
Event DoBeforeFinish(ByVal value As System.Object)
Event DoAfterFinish(ByVal value As System.Object)
Event DoAfterCancel(ByVal Value As System.Object)
End Interface
Interface from Type library using TLBEXP
interface WizardInterface : IDispatch {
[id(0x60020000)]
HRESULT remove_DoAfterFinish([in] _DoAfterFinishEventHandler* obj);
[id(0x60020001)]
HRESULT add_DoAfterFinish([in] _DoAfterFinishEventHandler* obj);
[id(0x60020002)]
HRESULT add_DoAfterCancel([in] _DoAfterCancelEventHandler* obj);
[id(0x60020003)]
HRESULT remove_DoAfterCancel([in] _DoAfterCancelEventHandler* obj);
[id(0x60020004)]
HRESULT remove_DoBeforeFinish([in] _DoBeforeFinishEventHandler*
obj);
[id(0x60020005)]
HRESULT add_DoBeforeFinish([in] _DoBeforeFinishEventHandler* obj);
[id(0x60020006)]
HRESULT Init([in] VARIANT_BOOL bShowWelcomePage);
[id(0x60020007)]
HRESULT NextPage([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020008)]
HRESULT BackPage([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020009)]
HRESULT Show();
};