Microsoft Chat Server Development Guide

Communicate with the extension

When properties are invoked for the extension, the Chat Service Manager will pass a reference to the ChatServer object. If the configuration is being performed from a Channels property page, the second selected control is a reference to the IChatPersistentChannel interface of the associated channel. These interfaces are made available using the SelectedControls global collection in Visual Basic, or the m_ppUnk member variable in C++.

After an interface to the ChatServer object is retrieved, the extension instance can be located as follows:

Set myExtension = ChatServer.Configuration.ChatExtensions(<extension_name>).Instance

Administration is normally performed through the specialized interface defined and supported by the extension. If your extension does not have a specialized administration interface, you can invoke the IChatExtensionCallback::OnConfigureExtension method instead.

The following Visual Basic example demonstrates how to access the running instance of the extension using the global variable SelectedControls and implicitly convert the returned instance into the appropriate administrative interface to the extension:

Dim gBlockSvr As ChannelBlockExtension.ChannelBlocking

Private Sub PropertyPage_SelectionChanged()
    Dim CServer As CHATSVCLib.ChatServer
    
    If SelectedControls.Count > 0 Then
        ' We are passed a reference to the ChatServer object by SelectedControls(0)
        Set CServer = SelectedControls(0)
        If Not CServer Is Nothing Then
            Set gBlockSvr = CServer.Configuration.ChatExtensions("ChannelBlocking").Instance
            If Not gBlockSvr Is Nothing Then
                Call FillNameList
            End If
        End If
    End If
End Sub

Note to C++ Developers: The Instance property of the ChatExtension object returns a variant containing the IDispatch interface of the extension. You must use QueryInterface using the IID assigned to your extension to convert the IDispatch interface into the administration interface of your extension. Refer to the MsgFilter sample for more information.


© 1998 Microsoft Corporation. All rights reserved.