procedure
TForm1
.
Button1Click(Sender: TObject);
var
pwdset:IMsRdpClientAdvancedSettings;
begin
Mstsc1
.
Server:=edtIP
.
Text;
Mstsc1
.
UserName:=edtName
.
Text;
if
Mstsc1
.
AdvancedSettings
.
QueryInterface(IID_IMsRdpClientAdvancedSettings,pwdset) = s_ok
then
begin
pwdset
.
ClearTextPassword:=edtPwd
.
Text;
pwdset
.
RDPPort:=
3389
;
end
;
Mstsc1
.
Connect;
end
;