简体   繁体   English

Mstsc ActiveX 控件警告

[英]Mstsc ActiveX Control Warning

I'm working in a project that the application needs to connect into a remove desktop (RDP Protocol), automatically.我在一个项目中工作,应用程序需要自动连接到删除桌面(RDP 协议)。 For this, I'm using the library MSTSCLib_TLB, from Delphi, which uses mstscax.dll.为此,我使用了来自 Delphi 的库 MSTSCLib_TLB,它使用了 mstscax.dll。 The problem is that the Windows identifies the connection is coming from an ActiveX control, and display this warning:问题是 Windows 识别出连接来自 ActiveX 控件,并显示以下警告:

在此处输入图片说明

This warning is making difficult to connect automatically on the server.此警告使服务器上的自动连接变得困难。

Note: "A website is trying to start a remote connection", while I'm doing this from an executable... I read on the Internet about this message, and tried some solutions on Windows registry, but none of them solved the problem.注意:“网站正在尝试启动远程连接”,而我正在从可执行文件中执行此操作...我在 Internet 上阅读了有关此消息的信息,并在 Windows 注册表上尝试了一些解决方案,但没有一个解决了问题. I accept solutions that work on the Windows registry to stop displaying this warning, but I prefer programmatically solutions .我接受适用于 Windows 注册表的解决方案以停止显示此警告,但我更喜欢以编程方式解决方案 I saw a sugestion to sign the ActiveX object using IObjectSafety and set SetInterfaceSafetyOptions to "INTERFACESAFE_FOR_UNTRUSTED_CALLER", but I have no idea about what this means and how to achieve that.我看到了使用 IObjectSafety 对 ActiveX 对象进行签名并将 SetInterfaceSafetyOptions 设置为“INTERFACESAFE_FOR_UNTRUSTED_CALLER”的建议,但我不知道这意味着什么以及如何实现。

My application is coded on Delphi, and I'm on Windows 10. The code so far is:我的应用程序是在 Delphi 上编码的,我在 Windows 10 上。到目前为止的代码是:

procedure TForm1.Button1Click(Sender: TObject);
var
  Client: TMsRdpClient9;
begin
  Client:= TMsRdpClient9.Create(Self);
  Client.Parent:= Self; //dont know why, but this ActiveX control needs a parent
  Client.Server:= Edit1.Text;
  Client.UserName:= Edit2.Text;
  Client.AdvancedSettings9.ClearTextPassword:= Edit3.Text;
  Client.OnLoginComplete:= LoginComplete;
  Client.Connect;
end;

Got it.知道了。 Instead of using "TMsRdpClient9" I used "TMsRdpClientNotSafeForScripting" with the following code:我没有使用“TMsRdpClient9”,而是使用带有以下代码的“TMsRdpClientNotSafeForScripting”:

procedure TForm1.Button1Click(Sender: TObject);
var
  Client: TMsRdpClientNotSafeForScripting;
begin
  Client:= TMsRdpClientNotSafeForScripting.Create(Self);
  Client.Parent:= Form1;
  Client.Server:= Edit1.Text;
  Client.ControlInterface.UserName:= Edit2.Text;
  Client.AdvancedSettings2.ClearTextPassword:= Edit3.Text;
  Client.Connect;
end;

The essence of the answer provided by user3810691 works also for C# WinForms. user3810691 提供的答案的本质也适用于 C# WinForms。 In the COM Components tab (for Choose Toolbox Items) go for:在 COM 组件选项卡(用于选择工具箱项目)中,选择:

Microsoft RDP Client Control - version 10 Microsoft RDP 客户端控制 - 版本 10

instead of:代替:

Microsoft RDP Client Control (redistributable) - version 10 Microsoft RDP 客户端控制(可再发行)- 版本 10

This will give you the "not safe for scripting" version 9 (sic!) control type:这将为您提供“脚本不安全”版本 9(原文如此!)控制类型:

AxMSTSCLib.AxMsRdpClient9NotSafeForScripting

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM