无法使用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 = System@R_574_404[email protected];
                rdpClient.DesktopHeight = System@R_574_404[email protected];
                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 (将#修改为@)