|
JWSCL Documentation
|
function GetEnumerator: TJwSessionsEnumerator;
(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).
var ATerminalServer: TJwTerminalServer; Session: TJwWTSSession; begin // Create Terminal Server instance and allocate memory for it ATerminalServer := TJwTerminalServer.Create; // It's recommended to wrap the Connect call in a try..except block since // a connection failure will raise an exception. try ATerminalServer.Connect; except on E: EJwsclWinCallFailedException do begin // Handle Exception here end; end; // EnumerateSessions might fail and return false, so always check the // result. if ATerminalServer.EnumerateSessions then begin // Loop through the Sessions with the for..in loop (needs Delphi 2005 // or higher). for Session in ATerminalServer.Sessions do begin Memo1.Lines.Add(Format('User %s has session %d, the session state is %s', [Session.Username, Session.SessionId, Session.ConnectStateStr])); end; end; // Free Memory (note that free will automatically disconnect an active // connection) ATerminalServer.Free; end;
|
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!
|