本文介绍了嵌入式RDP客户端在WinForms中挂起(AxMsRdpClient7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#中的ocx for Remote Desktop将RDP窗口嵌入到我的应用程序中.问题在于RDP窗口将不时地挂起",这意味着没有任何交互作用(鼠标,键盘)影响RDP控件(窗口).唯一的办法 使其解脱"是生成(或转到)另一个RDP控件,单击它,然后返回到先前挂起的RDP控件,然后单击它-然后我恢复控件并可以与它进行交互.

I'm using the ocx for Remote Desktop in C# to embed RDP windows in my application. The problem is that from time to time, the RDP window will "hang", meaning no interaction whatsoever (mouse, keyboard) is affecting the RDP control (window). The only way to get it to "unhang" is to spawn (or go to) another RDP control, click in it, then go back to the previously hanged one and click in it - then I resume control and can interact with it. 

当我第一次在RDP控件中使用鼠标,然后在RDP控件之外的窗体上单击某个位置之后立即使用鼠标时,似乎会发生这种情况.

It seems to happen when I first use the mouse in the RDP control and then directly after clicks somewhere on the form outside of the RDP control. 

这是我的用于实例化RDP控件的代码:

Here's my code to instantiate the RDP control: 

AxMsRdpClient7 client = new AxMsRdpClient7();

            ((ISupportInitialize)client).BeginInit();
            client.Enabled = true;
            client.Visible = true;
            client.Dock = DockStyle.Fill;
            client.Location = new System.Drawing.Point(0, 0);
            client.Name = "MsRdpClient - " + server;            

            targetControl.Controls.Add(client); //add to specified location
            
            ((ISupportInitialize)client).EndInit();

            client.Name = targetControl.Text; //for identification
            client.OnDisconnected += new AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEventHandler(client_OnDisconnected);
            client.AdvancedSettings7.SmartSizing = true;
            if (injectCredentials)
            {
                client.UserName = rdpDomain + "\\" + rdpUsername;
                IMsTscNonScriptable secured = (IMsTscNonScriptable)client.GetOcx();
                secured.ClearTextPassword = rdpPassword;
            }
            client.Server = server;

            client.Connect();

我非常感谢您的帮助-这确实使我们无法启动该应用程序!

I appreciate any help - this really stops us from launching this application!

推荐答案

client.AdvancedSettings.overallConnectionTimeout = 60; // default = 600
client.AdvancedSettings.singleConnectionTimeout  = 60; // default = 600

client.AdvancedSettings2.MaxReconnectAttempts = 1; / range = 0 - 200



这篇关于嵌入式RDP客户端在WinForms中挂起(AxMsRdpClient7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 12:59