Hi,
I would like to create a dual interface object that is connectable,
does anyone have any idea or any site that shows how to create an object in VB that supports connection points.
Thanks
MechEngCoder
Printable View
Hi,
I would like to create a dual interface object that is connectable,
does anyone have any idea or any site that shows how to create an object in VB that supports connection points.
Thanks
MechEngCoder
i'm not sure what do u mean, but every COM Object written in VB is Dual Interface.
could u explain more precisely what do u want?
Thanks for the reply,
I mean't I want to make a COM Object that uses Connection Points so that a number of client can recieve notifications and provide callback functions through an event interface provided by the clients. This means I need to be able to use IConnectionPointContainer, IConnectionPoint, etc that are required to make a connectable object. Any ideas on how I achieve this?
Thanks
MechEngCoder
I think what you are trying to do is the same as a project that I am working on at the moment.
Check out this link : http://www.edneeis.com/
Look in the samples section. there are a couple of good examples
Thanks for the reference,
It was not exactly what I had in mind (I thought I might be able to use Implements Keyword in some way to use allow the Client to provide a Callback function through the IConnectionPointContainer), however I don't think I will be able to achieve this with VB. A less tidy solution is to use the events to notify the client to query the server for the data required, like how an ActiveX Control works. I guess I can live with this. Thanks for your input.
MechEngCoder
I tried various ways of doing it and this is the only way I could get to work.
Project timescales dictated that I had to settle for this.
If you find an alternative way of doing it please let me know.
am i wrong? isn't VB have built in support for evnets?
C++ programmers have to implement IConnectionPoint interface, so they can notify their clients (aka Events), i still don't figure out what do you want?
here is an example of how using events in VB:
Server code (called MyDLL.MyClass):
Option Explicit
Public Event Notify(Msg As String)
Public Sub TrigNotify()
RaiseEvent Notify("This is a message from the server")
End Sub
and the client code:
Option Explicit
Dim WithEvents o As MyDLL.MyClass
Private Sub Command1_Click()
o.TrigNotify
End Sub
Private Sub Form_Activate()
Set o = New MyDLL.MyClass
End Sub
Private Sub o_Notify(Msg As String)
MsgBox Msg
End Sub
also, u shoul read the following article:
http://www.microsoft.com/msj/default...alprog0499.htm
Deja,
Thanks for the reply.
The article you gave a link to is long, I will read it when I have time.
The problem I was having was when trying to connect multiple clients to the server. Each client must see the same data.
Two points :-
1. I need to use DCOM so I have written an ActiveX.exe. This runs out of process.
2. Won't the "Open as New" in the form acivate an the client side open a new instance of the server class. The server data will therefore be different for each client.
I'm new to COM/ActiveX (as you can probably tell) so please put me right on the above if you think I can write my program in a better way.
hi again,
i think u don't need ActiveX EXE for your purpose.
u should move to COM+.
in COM+ u can run your DLL in an Out Of Process (and remotely using DCOM) either (called DLL Surrogate), and can share data between clients using SPM (Shared Property Manager).
i'm not reccomend to use ActiveX EXE, it has some problems (u can conroll it very well), in COM+ u have more control on your components and a few helper services.