473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

COM+ written in C# from VB6 - who can?

Hi,

Did anybody use the C# class library from VB6 ?

I wrote a standard COM+ interface for this C# class library, the system sees
this COM+ object, can show the interface etc., but VB6 can't create the
object.

I found a couple of good links as I supposed and made the whole job
according these links, everything's fine until I try to create the COM+
object from VB6 application. What I'm doing wrong?

This is a CS class, I created a strong name using SN and added it to the
Assembly, then registered the whole assembly in GAC. It should be there.

----------------------------------------------------------------------------
-------------------------------------
using System;

using System.Runtime.InteropServices;

//--------------------------------------------------------------------------
-----------------------

namespace ToDo

{

[Guid("3A24D643-4E18-4488-907F-F076ABE703CB")]

public interface ToDoWrapper_Interface

{

[DispId(1)]

int Init(int i1, int i2, int i3, string s);

[DispId(2)]

int Create(string s);

}

//--------------------------------------------------------------------------
-----------------------

// Events interface Database_COMObjectEvents

[Guid("03001849-1DBD-471c-97C0-3ADAA1C545DA"),

InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]

public interface ToDoWrapper_Events

{

}

//--------------------------------------------------------------------------
-----------------------

[Guid("5E67AF8F-01E2-4284-ABD7-FA03B51EE9BD"),

ClassInterface(ClassInterfaceType.None),

ComSourceInterfaces(typeof(ToDoWrapper_Events))]

//--------------------------------------------------------------------------
-----------------------

public class ToDoWrapper_Class : ToDoWrapper_Interface

{

private int m_i1 = 0;

private int m_i2 = 0;

private int m_i3 = 0;

private string m_s = "";

//--------------------------------------------------------------------------
-------------------

public ToDoWrapper_Class()

{

}

//--------------------------------------------------------------------------
-------------------

public int Init(int i1, int i2, int i3, string s)

{

m_i1 = i1;

m_i2 = i2;

m_i3 = i3;

m_s = s;

return 0;

}

//--------------------------------------------------------------------------
-------------------

public int Create(string s)

{

return 0;

}
}

}

----------------------------------------------------------------------------
--------------------------------------------------------------------

Then I created a VB6 application like:

Dim o As Object
Private Sub Command1_Click()
Set o = CreateObject("ToDoWrapper.CToDoWrapper_Class")
Dim myResult As Object
myResult = o.Init(1,2,3,"")
MsgBox "Complete", vbOKOnly, "Complete"
End Sub

The program dies at the CreateObject()

Why?

Thanks,

Dmitri.

Nov 22 '05 #1
0 1103

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

Similar topics

2
by: IK | last post by:
Hello All, Please excuse me for posting this here, but I don't find any other group where I will get a proper answer. This is about clarifying the C++ part of COM. I understand that COM is a...
1
by: Daniel | last post by:
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a...
1
by: Uty | last post by:
As the subject suggests, I have two questions about using COM objects in C#. I'm using two different objects, each of which is giving me a problem. The first object ... we'll call it AppXControl....
1
by: Konrad Kataneksza | last post by:
Hi, I have written COM in C#. This COM is called by an application written in Delphi 5. I want to be able to debug my COM when it is called by mentioned application. MS Visual Studio runs...
7
by: TJ | last post by:
In C# how do you achieve pass-by-reference property declarations in the Type Library? I am writing a COM Class Library that must mimick an existing library for which the only information is the...
0
by: Just D. | last post by:
All, Is it possible to write a COM+ component in C# with some GUI to use it from a native application written for example in VB? Afaik this component is using the different libraries and it's...
132
by: Kevin Spencer | last post by:
About 2 years ago, and as recently as perhaps 1 year ago, I can recall seeing many posts about what language to use with ASP.Net. The consensus was that employers paid more for C# programmers, and...
8
by: Amit | last post by:
Hello group, I will appreciate it if you give me some advice on my question: I am asked to write a program. This program is supposed to act as "Adobe PDF" feature which some of you either have...
14
by: Franz Steinhäusler | last post by:
Hello NG, wWhat are the best programs in your opinion, written entirly in pyhton, divided into categories like: a) Games b) Utilities/System c) Office d) Web/Newsreader/Mail/Browser ....
61
by: giveitawhril2008 | last post by:
I'm just learning about Python now and it sounds interesting. But I just read (on the Wiki page) that mainstream Python was written in C. That's what I was searching for: Python was written in what...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.