德尔福ActiveX MSTSCLib [英] Delphi ActiveX MSTSCLib

查看:101
本文介绍了德尔福ActiveX MSTSCLib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用一些用于MS-RDP的Delphi ActiveX库(mstscax.dll),因此我将该库导入了我的项目,并开始在网络上查找一些代码片段.乍一看,这很明显,但是由于缺少示例,因此有点复杂.

I'm trying to play around with some Delphi ActiveX library for MS-RDP (mstscax.dll), so I imported the library into my project, and started looking for some codes snippets on the web. On a first look, it's pretty obvious, but the lack of examples makes it a little complex.

首先,该库在西雅图德尔福(Delphi Seattle)上出现以下错误:

First the library gives an error on Delphi Seattle, on this line:

property ConnectWithEndpoint: POleVariant1 write Set_ConnectWithEndpoint;

好的,我把这一行注释掉了(我知道这不是最好的解决方案),但是已经编译了.后来,我尝试仅将POleVariant1更改为OleVariant,并且仍在进行编译.好的,编译后,我尝试了以下代码:

Ok, I commented this line out (not the best solution, I know), but it compiled. Later I tried to change POleVariant1 to OleVariant only, and still compiling. Ok, after compiled, I tried this code:

var
  Form1: TForm1;
  RDP: TMsRdpClient8NotSafeForScripting;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  RDP:= TMsRdpClient8NotSafeForScripting.Create(Nil);
  RDP.Server:= 'xxxx';
  RDP.AdvancedSettings8.RDPPort:= 3389;
  RDP.UserName:= 'terminal';
  RDP.AdvancedSettings8.ClearTextPassword:= '123456';
  RDP.Connect;
  if RDP.Connected.ToBoolean = true then
    ShowMessage('connected')
  else
    ShowMessage('error');

end;

我为var RDP尝试了一些不同的类型,例如仅TMsRdpClient8,但是仍然存在相同的问题:它甚至没有尝试进行连接!在嗅探器上查找时,没有建立任何TCP连接,什么也没有发生,并且出现错误"消息.关于如何与这个人一起工作的任何想法?

I tried some different types for the var RDP, like TMsRdpClient8 only, but still the same problem: It don't even try to connect! While looking on the sniffer, no tcp connections are made, just nothing happens and the "error" message appears. Any idea about how to work with this guy?

推荐答案

这个问题引起了我的兴趣,因此我尝试导入该ActiveX控件并自己进行尝试.它似乎对我有用,所以我将解释自己的工作.

This question intrigued me so I tried to import that ActiveX control and try it myself. It seems to work for me, so I'll explain what I did.

我导入了mstscax.dll ActiveX控件,然后将其添加到新程序包中,以便将组件安装到工具选项板上.我立即遇到了您对ConnectWithEndpoint属性所做的错误.我将声明中的类型更改为OleVariant,因为Set_ConnectWithEnpoint属性设置器函数采用了OleVariant.我们的ActiveX导入程序代码很容易混淆类型信息.无论哪种方式,该更改都会使文件得以编译并安装组件包.现在有很多TMsRdpClientXXXX组件.

I imported the mstscax.dll ActiveX control then added it to a new package in order to install components onto the tool palette. I immediately ran into the error you did with the ConnectWithEndpoint property. I changed the type in the declaration to OleVariant because the Set_ConnectWithEnpoint property setter function takes an OleVariant. There is clearly something about the type information that our ActiveX importer code is getting confused by. Either way, that change got the file to compile and install the component package. There are now a bunch of TMsRdpClientXXXX components.

创建一个新的VCL Forms项目,然后将TMsRdpClient9组件放入该表单中.添加了一个TButton,然后将此代码添加到了按钮的OnClick处理程序中:

Created a new VCL Forms project, then dropped the TMsRdpClient9 component into the form. Added a TButton and then added this code into the button's OnClick handler:

  MsRdpClient91.Server := '<some remote server>';
  MsRdpClient91.Domain := 'embarcadero.com';
  MsRdpClient91.UserName := 'abauer';
  MsRdpClient91.Connect;

一旦我运行该应用程序并按下按钮,它便已连接,并且ActiveX控件的内容显示远程服务器登录屏幕就很好了.

Once I ran the app, and pressed the button, it connected and the content of the ActiveX control showed the remote server login screen just fine.

我正在运行Windows 10,版本10565.

I'm running Windows 10, build 10565.

这是我在我写的小应用程序中看到的内容:

Here's what I'm seeing on my little app I wrote:

这篇关于德尔福ActiveX MSTSCLib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆