Location: Symbol Reference > Classes > TJwWTSSessionList Class
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwWTSSessionList Class
Pascal
TJwWTSSessionList = class(TObjectList);

TJwWTSSessionList is a List of all Sessions running on the Terminal Server and their properties 

Each item in the list points to a TJwWTSSession object that can be queried and manipulated. The list is filled by calling the EnumerateSessions function of the owning TJwTerminalServer instance.

var
  ATerminalServer: TJwTerminalServer;
  i: Integer;
begin
  // Create Terminal Server instance and allocate memory for it
  ATerminalServer := TjwTerminalServer.Create;

  // Set servername (only in case of remote server)
  ATerminalServer.Server := 'TS001';

  // Remember that EnumerateSessions will automatically connect to the
  // Terminal Server for you. The connect function raises an Exception
  // if the connection attempt was unsuccessfull, so better use try..except
  try
    if ATerminalServer.EnumerateSessions then
    begin
      for i := 0 to ATerminalServer.Sessions.Count-1 do
      begin
        Memo1.Lines.Add(ATerminalServer.Sessions[i].Username);
      end;
    end;
  except
    on E: EJwsclWinCallFailedException do
    begin
     // Handle Exception here
    end;
  end;

  // Free Memory
  ATerminalServer.Free;
end;
 
Name 
Description 
 
The Destroy destructor destroys the @Classname instance. Note that it is not necessary to manually free a @Classname as it will be freed when the TJwTerminalServer instance that owns the @Classname (Owner property) is freed. 
Name 
Description 
The following tables list the members exposed by TJwWTSSessionList. 
The methods of the TJwWTSSessionList class are listed here. 
The properties of the TJwWTSSessionList class are listed here. 
 
Name 
Description 
 
Add 
Add adds a Session to the end of the Sessionlist  
 
FindBySessionId loops through the @Classname and returns the Session associated with the requested SessionId.  
 
FindByUsername loops through the @Classname and returns the first Session associated with the requested Username which is compared case insensitive.  
 
(GetEnumerator returns an enumerator that can be used to iterate through the image list collection with Delphi's for in loop (Delphi 2005 and higher).
 
 
 
 
Insert Adds an object to the list at a specified position 
 
Remove removes the specified Session from the SessionList and if OwnsObjects is true (default) frees the Session.  
 
Name 
Description 
 
Data 
This is Data, a member of class TJwWTSSessionList. 
 
The Items[Index properties gives access to a Session and it's properties 
 
Owner Specifies the TJwTerminalServer instance that owns the @Classname 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!