Results 1 to 7 of 7

Thread: Callback or events?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Callback or events?

    What are the advantages and disadvantages of using callbacks instead of events in a client/server, without RA, setting?

    Speed? Distribution issues? OS requirements?

    I've pretty much stayed away from com/dcom as we've always been concerned about 9x issues and wanted to avoid having system requirements imposed on users but since I'm about to distribute an app for which dcom is required I'm considering implementing callbacks.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Callback or events?

    I don't know if there are any speed advantage of using a callback instead of an event, but I don't think so. However you can't use callbacks in VB since VB can't call a function by address (except from a trick I published here that uses CallWindowProc). Using events is the prefered way of handling callbacks from COM/DCOM components.

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Callback or events?

    VB can call a function by an Address using the AddressOf command.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Callback or events?

    Quote Originally Posted by Jacob Roman
    VB can call a function by an Address using the AddressOf command.
    No, VB can pass the address of a function by using the AddressOf keyword. But you can't call that function using that address.

  5. #5
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Callback or events?

    Gotcha, my mistake.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Callback or events?

    anotherVBnewbie,

    If you're considering implementing callbacks how do you think you're going to do it? (I don't mean this in a rude way because you can actually do it, but there are a variety of ways to).

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    In front of this pc.
    Posts
    580

    Re: Callback or events?

    Okay, I finally got up from my nap

    It seems that the term "callbacks" has 2 uses with the most common association being with API calls, when being referenced in relation to VB anyway.

    However,the second use of the term is the one I am interested in. I found this article on the MS site entitled "SAMPLE: VB5DCOM.EXE: Using Callbacks and WithEvents with DCOM" The sample client/server application demonstrates both methods of the server interacting with the client so maybe I just need to further develope the demo and perform some test but since I'm a lazy bird.....

    I asked about the speed because I have a Pop3 component which supports both methods and the associated documentation says that callbacks can be up to 30 times faster. Not knowing whether that is specific to this particular component's implementation or an "across the board" condition is why I'm asking. Actually, thar reference to callback speed is what prompted me to start looking into this.

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