Results 1 to 10 of 10

Thread: Connection Point Container

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    30

    Question 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

  2. #2
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    30
    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

  4. #4
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    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.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Location
    Australia
    Posts
    30
    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

  6. #6
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    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.

  7. #7
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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?

  8. #8
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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

  9. #9
    Hyperactive Member Simon Caiger's Avatar
    Join Date
    Aug 2000
    Location
    Rugby, England
    Posts
    377
    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.

  10. #10
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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
  •  



Click Here to Expand Forum to Full Width