简体   繁体   中英

C# RDP ActiveX Control losing focus

I am programming a simple terminal server application and I am having trouble with the MSTSCLib activeX component. The form loads and the remote desktop connection works, however, as soon as another control is clicked the remote desktop control stops responding. When I click on it the control just sends a ding noise. Why does it do this its as if i cant regain focus from a click?

If i use the tab key the remote desktop control will respond again. What is the difference between these two methods of connection?

Thanks for your help.

Seems like a known issue with that ActiveX control, the proposed workaround worked for me:

public class RdpClient : AxMSTSCLib.AxMsRdpClient71
{
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == 0x0021)
        {
            Focus();
        }

        base.WndProc(ref m);
    }
}

You could try creating a button or Context menu attached to a notify icon and set focus to the remote desktop.

    private void button1_Click(object sender, EventArgs e)
    {
        remotedesktop.Focus();
    }

Every-time you lose focus just click

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM