472,952 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 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 986
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.