运行delphi-->Components-->Import Active Control,在列表中找到下面的 Microsoft Terminal Services Active Client 1.0 Type Library (Version 1.0), 点击install 参考代码如下: var proj: ImsRdpclientAdvancedSettings; //定义密码用 p1: IMsRdpClientAdvancedSettingsDisp; //自定义端口用 begin if MsRdpClient21.AdvancedSettings.QueryInterface(ImsRdpclientAdvancedSettings, proj) = S_OK then begin MsRdpClient21.UserName := 'test'; proj.Set_ClearTextPassword('123456'); if RDform.MsRdpClient21.AdvancedSettings.QueryInterface(IMsRdpClientAdvancedSettingsDisp, p1) = S_OK then p1.RDPPort := StrToInt(Rport); end; MsRdpClient21.Server := '127.0.0.1'; MsRdpClient21.Connect; .... end;