Click here to Skip to main content
16,016,910 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
28 Feb 2012CPOL 15.4K   2  
I had to modify your code a little to deal with some issues I was having. This will only focus if it needs to be focused.public class MsRdpClient7 : AxMSTSCLib.AxMsRdpClient7{ public MsRdpClient7() : base() { } protected override void WndProc(ref...

I had to modify your code a little to deal with some issues I was having. This will only focus if it needs to be focused.


C#
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
            if (this.ContainsFocus == false)
            {
                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)


Written By
Unknown
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --