Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 12

Providing an Interface for the Callback Object

If you want to give your server's clients the capability to use callback objects, you must define an Interface for the callback object in a Server class.

To define the callback object's Interface, you must take the following steps:

  1. Create a class in your server project and name it appropriately (remember the convention of using the letter I as a prefix to Interface class names).

  2. Set the class Instancing property to Global MultiUse.

  3. Define the Interface class's members (the properties and methods).

As you will recall, an Interface is a blank class template, so it's not a difficult proposition to define its properties and methods. Moreover, a callback class really only requires a single method to implement the callback. An Interface definition of a callback class could therefore be as simple as the code in Listing 12.21.

LISTING 12.21
A CALLBACK INTERFACE CLASS

'The Class name = INotification
Option Explicit
Public Sub Notify(msg As String)
End Sub

Notice that the code in the listing specifies a String parameter. This would allow the server to send a message back to the client as part of the notification. It is up to you whether you want to provide such features in your notification method.

The next section discusses how a client programmer could use this Interface to implement a callback object and pass it to the server.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved