Location: Symbol Reference > Classes > TJwTerminalServer Class > TJwTerminalServer Methods > TJwTerminalServer.Disconnect Method
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwTerminalServer.Disconnect Method
Pascal
procedure Disconnect;

Disconnect will disconnect an existing connection to the Terminal Server. The Connected property can be used to check if we're already connected.

If you disconnect you will not receive Session Events!

   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 EnumerateProcesses 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
    Connect
  except
    on E: EJwsclWinCallFailedException do
    begin
      // Handle Exception here
    end;
  end;

  ...

  // Disconnect
  ATerminalServer.Disconnect;

  // Free Memory (note that the free procedure will automatically
  // disconnect from the server if connected)
  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!