Jochen Z

Hi,

I'm writing a windows forms application and I need remote desktop within that application.

I referenced MSTSCLib and used the RDP client control. The control is embedded in a TabControl.

Everything works fine, except for one very annoying thing: when I switch tabs and return to the RDP client control tab, the RDP client no longer responds to any user interaction (mouse clicks, keyboard commands).

I tried explicitly focussing the RDP control on the tab switch, but that does not help.

I have a very simple demo app, which can be requested by mail (jochen__-at-__dedigate___dot___com).

It contains a single form, with a tabcontrol which has 2 tab pages. The first tab page contains the RDP Client control axMsTscAx1. The written code is shown below:

public Form1()

{

InitializeComponent();

axMsTscAx1.Server = "a server";

axMsTscAx1.Height = 600;

axMsTscAx1.Width = 800;

axMsTscAx1.UserName = "a user name";

// can't assign a password

axMsTscAx1.Connect();

}

 

Any help would be appreciated!

Jochen



Re: Windows Forms General Remote Desktop client embedded in TabControl

Kyle J.

Did you solve this

I'm interested in your app. Are you creating a "remote support" feature in your software We need to have the ability to troubleshoot systems that have our software. Something similar to webex.






Re: Windows Forms General Remote Desktop client embedded in TabControl

Timothy Carroll

This is a limitation of the tab control when used with the remote desktop AX control. The tab control listens for a mouse click event and then sends focus to its children. The AX control does not set focus, nor notify the parent when it is clicked (it sends all clicks to the remote terminal). I wrote a tabbed remote desktop client (called RD Tabs, available here: http://www.avianwaves.com/tech/tools/rdtabs) which ran into this exact issue. I solved it by listening for all other possible messages that indicate that focus needs to be sent to the AX control. Things like when a tab panel is "activated" or when the main windows form is "activated" or when the tab control itself is "clicked" (the tabs along the top), and so on. It can also be fixed by creating your own unmanaged message parser that hooks into the OS and listens to all input, then waiting for mouse clicks, checking where they are, and sending .Focus() to the AX control when it is clicked on. This is not exactly trivial. Due to all the problems I had, I wrote my own "tab control" which handles setting focus natively within it (coming in the next release). It's not exactly something I can post code for because it's tightly integrated (read: hardwired) into the rest of the application. Good luck! Hope my hints help you out some.





Re: Windows Forms General Remote Desktop client embedded in TabControl

Anonymous_2075

Jochen,

When ever u select RDP client control tab, call axMsTscAx1.Focus() on it. It works ! It is tested. I worked on RDP Tool and I had similar issue. This is the only way to make it work.