Click here to Skip to main content
11,715,425 members (75,790 online)
Click here to Skip to main content

Tagged as

Fix the focus issue on RDP Client from the AxInterop.MSTSCLib.dll

, 18 Sep 2010 CPOL 21.2K 4
Rate this:
Please Sign up or sign in to vote.
Quick and dirty fix for the focus issue on the RDP Client.
If you ever worked with the RemoteDesktop Client from Microsoft, you probably ran into this bug.

When selecting another component on your application, the client of course loses focus, but when you want to select the client component again, the only way is to use the TAB button, you won't be able to select the client component with the mouse button, so here's a fix. Wink | ;)

public class MsRdpClient2 : AxMSTSCLib.AxMsRdpClient2
{
    public MsRdpClient2()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}
public class MsRdpClient3 : AxMSTSCLib.AxMsRdpClient3
{
    public MsRdpClient3()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}
public class MsRdpClient4 : AxMSTSCLib.AxMsRdpClient4
{
    public MsRdpClient4()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}
public class MsRdpClient5 : AxMSTSCLib.AxMsRdpClient5
{
    public MsRdpClient5()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}
public class MsRdpClient6 : AxMSTSCLib.AxMsRdpClient6
{
    //Fix for the missing focus issue on the rdp client component
    public MsRdpClient6()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}
public class MsRdpClient7 : AxMSTSCLib.AxMsRdpClient7
{
    public MsRdpClient7()
        : base()
    {
    }
 
    protected override void WndProc(ref System.Windows.Forms.Message m)
    {
        //Fix for the missing focus issue on the rdp client component
        if (m.Msg == 0x0021) //WM_MOUSEACTIVATE ref:http://msdn.microsoft.com/en-us/library/ms645612(VS.85).aspx
            this.Focus();
        base.WndProc(ref m);
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

Comments and Discussions

 
GeneralThis is a good solution for the loss of focus of the control... Pin
David Kragar15-Feb-12 11:32
memberDavid Kragar15-Feb-12 11:32 
GeneralThis is a good solution for the loss of focus of the control... Pin
Colacurcio15-Feb-12 11:28
memberColacurcio15-Feb-12 11:28 
GeneralReason for my vote of 4 This is just what I needed to fix th... Pin
BruceCarson18-Oct-11 4:41
memberBruceCarson18-Oct-11 4:41 
Questiondragdrop Pin
quik36629-Feb-12 4:51
memberquik36629-Feb-12 4:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150901.1 | Last Updated 18 Sep 2010
Article Copyright 2010 by Paw Jershauge
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid