Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Anzahl der Terminal Server Sessions auslesen (https://www.delphipraxis.net/116283-anzahl-der-terminal-server-sessions-auslesen.html)

Remko 26. Jun 2008 19:07

Re: Anzahl der Terminal Server Sessions auslesen
 
You have to choose between using JwaWindows (which is really a single unit containing all other Jwa units) or using JwaWtsApi32. I recommend using JwaWindows in your case.
Note that the Jedi security library (Jwscl) contains a Terminal Server unit that wraps all Terminal Server API's. This makes your question really simple:

Delphi-Quellcode:
uses JwsclTerminalServer;
...

var
   TS: TJwTerminalServer;
   TS := TJwTerminalServer.Create;
   // You should check for errors and/or exceptions (see [url=http://jwscldoc.delphi-jedi.net/JwsclTerminalServer.TJwTerminalServer.html]documentation[/url]) but left out here to shorten code
   TS.EnumerateSessions;
   ShowMessageFmt('%d Terminal Sessions', TS.Sessions.Count);
   TS.Free;
The Connectstate property can be used to filter specific sessions (eg only active ones), from the docs:
ConnectState returns the connection state of the session. Which can be one of the following values:

Session State Description
WTSActive The session is connected, and a user is logged on to the server.
WTSConnected The session is connected, but there is no user logged on to the server.
WTSConnectQuery The session is in the process of connecting. If this state continues, it indicates a problem with the connection.
WTSShadow The session is in the process of remotely controlling another session.
WTSDisconnected The user is disconnected from the session, but the session is still attached to the server and can be reconnected at any time.
WTSIdle The session is initialized and ready to accept a connection. To optimize the performance of a server, two default (idle) sessions are initialized before any client connections are made.
WTSReset The session failed to initialize correctly or could not be terminated, and is not available. If this state continues, it indicates a problem with the connection of the session.
WTSInit The session is in the process of initializing.

Dezipaitor 26. Jun 2008 21:47

Re: Anzahl der Terminal Server Sessions auslesen
 
JwaWindows erfordert etwas Vorarbeit. Damit JwaWindows.dcu erstellt wird solltest du diesem Tutorial folgen.
Die JWSCL erdordert dann nur noch den Quelltextpfad anzugeben : http://blog.delphi-jedi.net/2008/03/...o-setup-jwscl/

JwaWTSAPI32 einzubinden erfordert aber nicht JwaWindows. Denn JwaWindows bindet automatisch alle JwaXXX Units ein. Man sollte jedoch JwaWindows.dcu erstellen, da das Erstellen von JwaWindows.pas einige Zeit braucht.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:54 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz