ISCSessionCollection Interface

The following table contains information on the ISCSessionCollection interface:

Signature

Description

Valid Arguments

VARIANT_BOOL Remove(VARIANT SessionId)

Removes a Session object from the collection

SessionId:

  • VT_UNKNOWN � Pointer to the ISCSession interface. Removes the given session from the collection.
  • VT_I4 � Zero-based index in the session collection. Removes the session with the given index from the collection.

Example 28

The following example illustrates how to close a session using C++. It assumes that there is a Session object and the session is open. The examples use an Application object from Example 1:

void CloseSessions( ISCApplicationPtr & scAppPtr )
{   
    ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSessions();
    ISCSessionPtr scSessionPtr = scSessionColPtr->GetItem(COleVariant(0L))
    // close the sessions
    scSessionPtr->Close();    // close a single session
    scSessionColPtr->Clear();   // clear the collection of sessions
}

The following example illustrates how to close a session using Visual Basic .NET. It assumes that there is a Session object and the session is open. The examples use an Application object from Example 1:

Public Sub CloseSessions( scApp As SCAPI.Application )
    Dim scSessionCol As SCAPI.Sessions
    scSessionCol = scApp.Sessions
    Dim scSession As SCAPI.Session
    
    For Each scSession In scSessionCol
        scSession.Close
    Next
    While (scSessionCol.Count > 0)
        scSessionCol.Remove (0)
    End
End Sub