使用delphi制作自动登录的Windows终端服务客户端

运行delphi-->Components-->Import Active Control,在列表中找到下面的 Microsoft Terminal Services Active Client 1.0 Type Library (Version 1.0), 点击install

// 文档标题:使用delphi制作自动登录的Windows终端服务客户端
// 作者:扬帆
// 为防止不负责任的转载者遗漏作者信息,故在此插入此信息,请见谅.

参考代码如下:

var
  proj: ImsRdpclientAdvancedSettings; //定义密码用
   p1: IMsRdpClientAdvancedSettingsDisp;  //自定义端口用

begin

 if MsRdpClient21.AdvancedSettings.QueryInterface(ImsRdpclientAdvancedSettings, proj) = S_OK then
  begin

    MsRdpClient21.UserName := 'dfdf';
    proj.Set_ClearTextPassword('fg');

if RDform.MsRdpClient21.AdvancedSettings.QueryInterface(IMsRdpClientAdvancedSettingsDisp, p1) = S_OK then
            p1.RDPPort := StrToInt(Rport);

  end;
  MsRdpClient21.Server := '127.0.0.1';
  MsRdpClient21.Connect;

....

end;

posted @ 2009-03-09 23:42  iAdo  阅读(745)  评论(0编辑  收藏  举报