无法使用C#Windows窗体中的ActiveX控件加载通用动态虚拟通道

问题描述

我使用通用动态虚拟通道(UDVC):https://github.com/earthquake/UniversalDVC

正确设置了UDVC的所有内容后,Windows的MSTSC远程桌面连接可以在连接到计算机后成功加载UDVC-Plugin.dll。

我使用ActiveX控件AxMsRdpClient9NotSafeForScripting创建C#Windows窗体应用程序以远程Windows Server 2016计算机。问题是无法使用以下代码加载虚拟通道插件:

rdpClient.AdvancedSettings9.PluginDlls = strPluginName;

参考链接:https://docs.microsoft.com/en-us/windows/win32/termserv/using-the-remote-desktop-activex-control-with-virtual-channels

请检查以下代码:

using AxMSTSCLib;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RemoteControlClient
{
    public class RemoteDesktopApi
    {
        public void ConnectToComputer(string strMachineName,string strUsername,string strPassword)
        {
            try
            {
                var form = new RemoteControlClientForm();
                var rdpClient = new AxMsRdpClient9NotSafeForScripting();
                form.Controls.Add(rdpClient);
                form.Show();

                rdpClient.DesktopWidth = SystemInformation.VirtualScreen.Width;
                rdpClient.DesktopHeight = SystemInformation.VirtualScreen.Height;
                rdpClient.FullScreen = true;

                rdpClient.AdvancedSettings9.PluginDlls = strPluginName;
                //Plugin name could be "UDVC-Plugin.dll" or "{3C8458A3-2EBE-4840-BB07-3BA5BF810588}"
                rdpClient.Server = strMachineName;
                rdpClient.UserName = strUsername;
                rdpClient.AdvancedSettings8.ClearTextPassword = strPassword;
                rdpClient.AdvancedSettings3.ConnectToServerConsole = true;
                rdpClient.AdvancedSettings8.ConnectToAdministerServer = true;
                rdpClient.AdvancedSettings9.AuthenticationLevel = 2;
                rdpClient.AdvancedSettings8.EnableAutoReconnect = true;
                rdpClient.AdvancedSettings8.RedirectDrives = true;
                rdpClient.AdvancedSettings8.GrabFocusOnConnect = true;
                rdpClient.AdvancedSettings8.DisplayConnectionBar = true;
                rdpClient.AdvancedSettings8.EnableWindowsKey = 1;
                rdpClient.AdvancedSettings8.DisableCtrlAltDel = 1;
                rdpClient.AdvancedSettings8.allowBackgroundInput = 1;
                rdpClient.AdvancedSettings8.AcceleratorPassthrough = 1;
                rdpClient.AdvancedSettings8.BitmapPeristence = 1;
                rdpClient.AdvancedSettings8.Compress = 1;
                rdpClient.AdvancedSettings8.DoubleClickDetect = 1;
                rdpClient.AdvancedSettings7.EnableCredSspSupport = true;
                rdpClient.AdvancedSettings2.PerformanceFlags |= 0x00000080; //TS_PERF_ENABLE_FONT_SMOOTHING;
                rdpClient.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,"Error");
            }
        }
    }
}

我不知道在调用此语法之前是否错过了一些代码。 我需要在代码中创建或设置虚拟通道吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...