unit UnitMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, MSTSCLib_TLB, StdCtrls, ExtCtrls;

type
  TFrmMain = class(TForm)
    rdp: TMsRdpClient7NotSafeForScripting;
    procedure FormActivate(Sender: TObject);
  private
  public
    { Public declarations }
  end;

var
  FrmMain: TFrmMain;

implementation

uses
  UnitServer;

{$R *.dfm}

procedure TFrmMain.FormActivate(Sender: TObject);
begin

  Self.OnActivate := nil;
  Self.WindowState := wsMaximized;
  rdp.Align := alClient;
  FrmServer := TFrmServer.Create(nil);
  try
    FrmServer.ShowModal;
    if FrmServer.ModalResult = mrOk then
    begin
      rdp.Server := FrmServer.edtIP.Text;
      rdp.ControlInterface.UserName := 'administrator';
      rdp.AdvancedSettings7.RedirectDrives := true;
      rdp.AdvancedSettings7.RedirectPrinters := true;
      rdp.AdvancedSettings7.EnableCredSspSupport := True;
      rdp.AdvancedSettings7.SmartSizing := True;
      rdp.Connect;
    end
    else
    begin
      Application.Terminate;
    end;
  finally
    FreeAndNil(FrmServer);
  end;
end;

end.


posted on 2022-05-09 21:55  陆战队  阅读(770)  评论(0)    收藏  举报