473,388 Members | 1,340 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.

COM Interop -- check my code please

Hello,

after a lot of readings I've got something working. Can you please check --
is it enough? .Net server and COM-client, also I generated key file and
place "ref" to it in AssemblyInfo.vb this way:

<Assembly: AssemblyKeyFile("..\..\keyfile.snk")>

The code:

Namespace NSClientSource

<ComVisible(False)Public Delegate Sub DisconnectDelegate()

<GuidAttribute("4CD0B63A-5A3E-48d1-9E92-5C58B04909F1"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIDispatch)_
Public Interface ISClientEvents
Sub Disconnect()
End Interface

<GuidAttribute("F597E3DB-1BEB-4d41-8C3F-1CAA0AA6F659"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIDispatch)_
Public Interface ISClientMembers
Property Port() As Integer
Property Host() As String
End Interface

<ComSourceInterfaces(GetType(ISClientEvents)), _
ComDefaultInterface(GetType(ISClientMembers)), _
Guid("3964C432-8412-4c73-A04D-86D7C57D694E")_
Public Class SClient
Implements ISClientMembers
Public Event Disconnect As DisconnectDelegate

Public Enum EFaultReason
eFaultUnknown = 0
eFaultWrongLength = 1
...
End Enum

....


After all this I can use one (but not all) object in VB(A) application.
All members and events are "visible", exept that enum members are shown in a
bit strange way:

EFaultReason_eFaultUnknown
EFaultReason_eFaultWrongLength

and so on -- with prefix, is it OK, or there's a way to make it shown
without prefix?

The third one in my project is a Control -- is it possible to use it also?
Like ActiveX controls in old times?

Although it's visible in COM object browser (F2 in MSA) but there's no way
to place control in a form and use it. What should I read?

Without <ComVisible(False)DisconnectDelegate sub also shown in COM
client -- but I don't need it?

Thank you.

--
best regards!

Jul 11 '06 #1
1 999
Serge,
>All members and events are "visible", exept that enum members are shown in a
bit strange way:

EFaultReason_eFaultUnknown
EFaultReason_eFaultWrongLength

and so on -- with prefix, is it OK, or there's a way to make it shown
without prefix?
Yes it's ok, and there's not much you can do about it.

>The third one in my project is a Control -- is it possible to use it also?
Like ActiveX controls in old times?
No, hosting Windows Forms controls as ActiveX controls is generally
not supported (with a few exceptions).

>Without <ComVisible(False)DisconnectDelegate sub also shown in COM
client -- but I don't need it?
You don't have to expose the delegate class if that's what your
asking.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 11 '06 #2

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

Similar topics

6
by: Sudha | last post by:
Hi All, I am trying to use COM DLL in my C#. I have added this DLL in referance and all interface are working fine. I have one issue in calling function decleared like: void...
16
by: Asaf | last post by:
I am trying to create and use a COM object with C#.NET 2005. The assembly is set to "Register for COM interop" but when I am trying to call it from VB on Word 2003 I am getting this error: ...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
5
by: Dave | last post by:
I have an existing VC6 ATL COM DLL. It has a number of methods within it that take a byte array as the methods parameters. Here's what the IDL looks like in the VC6 DLL: HRESULT...
5
by: muriwai | last post by:
Hi, I have a C# assembly project under Visual Stuio 2008 Pro on Windows Server 2008. I converted the project from VS 2005. The project references COM->Microsoft CDO for Windows 2000 Library...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.