|
-
Nov 13th, 2002, 05:11 AM
#1
Thread Starter
Junior Member
Connection Point Container
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
-
Nov 13th, 2002, 06:55 AM
#2
Lively Member
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?
-
Nov 14th, 2002, 05:10 AM
#3
Thread Starter
Junior Member
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
-
Nov 14th, 2002, 05:35 AM
#4
Hyperactive Member
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
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
-
Nov 14th, 2002, 05:51 AM
#5
Thread Starter
Junior Member
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
-
Nov 14th, 2002, 05:55 AM
#6
Hyperactive Member
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.
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
-
Nov 14th, 2002, 08:03 AM
#7
Lively Member
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?
-
Nov 14th, 2002, 08:52 AM
#8
Lively Member
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
-
Nov 14th, 2002, 09:08 AM
#9
Hyperactive Member
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.
Simon Caiger
Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing.
-
Nov 17th, 2002, 01:15 AM
#10
Lively Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|