Resizing using smartsize with AxMsRdpClient (Microsoft Terminal Services Control Type Library COM)

I’ve been using the AxMsRdpClient from Microsoft Terminal Services Control Type Library COM (Imported from AxInterop.MSTSCLib) in a project through Visual Studio 2010 using VB.NET

and found the only way to re-size the RDP window via smart size is after making a connection at full size to the RDP and then forcing the size down.

This took me a good hour to work out since I can’t find any examples of this online.

I’m sharing this as it may help someone else looking to work with AxMsRdpClient

 
Private Sub ConnectScreen1_Click(sender As System.Object, e As System.EventArgs) Handles ConnectScreen1.Click
        ''Check if we are already connected to a RDP session - If so Return 
        If AxMsRdpClient8NotSafeForScripting1.Connected = 1 Then Return

        ''specify the server the RDP is going to connect up
        AxMsRdpClient8NotSafeForScripting1.Server = Settings.Default.RDP1
        AxMsRdpClient8NotSafeForScripting1.Height = 768
        AxMsRdpClient8NotSafeForScripting1.Width = 1024
        AxMsRdpClient8NotSafeForScripting1.ConnectingText = "Connecting..."


        ''enable smart sizing
        AxMsRdpClient8NotSafeForScripting1.AdvancedSettings7.SmartSizing = True


        ''connect up the RDP session
        AxMsRdpClient8NotSafeForScripting1.Connect()
        
        ''now resize
        AxMsRdpClient8NotSafeForScripting1.Height = 580
        AxMsRdpClient8NotSafeForScripting1.Width = 760
    End Sub

2 thoughts on “Resizing using smartsize with AxMsRdpClient (Microsoft Terminal Services Control Type Library COM)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.