473,388 Members | 1,322 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Interface defined in VB.Net and used in .Net and COM

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();
};
Nov 20 '05 #1
0 963

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
7
by: Stephan Rose | last post by:
Ok here is my scenario I have an interface called IScalar which describes a one dimensional number that has a certain unit of measurement. This interface is used to create multiple structures,...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
2
by: matthew_glen_evans | last post by:
Hi there, Quick one about interfaces in c#. It seems that it is illegal to declare types within an interface. I was quite used to doing this in VB.net where the interface can define a...
12
by: masoud bayan | last post by:
I've come across something in Interface implementation that I am not sure is correct behavior in VB.NET (and maybe C#) or not? Consider following example: Public Interface IShape
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
8
by: rn5a | last post by:
Suppose I have the following class code: Imports System Imports System.Data Imports System.Data.SqlClient Public Class DBSettings Private sqlCmd As SqlCommand Private sqlConn As...
7
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.