Results 1 to 7 of 7

Thread: Terminal Services Client control not refreshing when window size changes

  1. #1

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    34

    Terminal Services Client control not refreshing when window size changes

    *Updated the title to make this post more accurate to the issue*

    I am working on a program that includes a terminal services client so the user can RDP into a box. All of that is working. My issue is that when the user expands the window, everything on the form BUT the RDP connection expands to fit. Here's how I have it setup...

    The form has a tab control with 5 tabs. Each tab has boxes to enter a computer, user and password. Then, there is a group box inside of which is the terminal service client control. The reason I put it in the group box was so I could anchor the terminal service client to all 4 sides and not have to worry about avoiding the buttons.

    The controls on the form and in the tab page have been anchored to stay in place. I tried to do that with this control but it failed. It still maintains the size it was when I originally connect to the remote session. So I tried to have it dock to full screen. Same thing, it didn't budge.

    I ran a test where I made the background of the group box black to make sure it was actually expanding as expected. And it was. The off thing was, it looked like the client was expanding too. Filling all the area it should. However, the actual PC display was only visible in the small area the remote session started with, the rest of the area was just grey as shown below.

    Any guidance, article or help anyone can provide would be appreciated.
    Thanks in advance

    Name:  rdp.jpg
Views: 531
Size:  28.6 KB
    Last edited by dcj1978; May 20th, 2019 at 12:35 PM.

  2. #2
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: Terminal Services Client control not resizing

    Looks like a resolution problem. I would be interested in seeing how you coded this. There is probably a way to set the display resolution to that of the size of the container

  3. #3

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    34

    Re: Terminal Services Client control not resizing

    And if I run the program and full screen it, then connect to a remote session, it fills the screen. However, when I shrink the program, the remote session in it stays huge and leaves me with scroll bars. And just to be clear, the blur is added to the image after the fact.

    The code to connect is as follows...
    Code:
     Try
                rdpView.Server = "domain\" + txtComputerName.Text
                rdpView.UserName =  txtUserName.Text
    
                Dim isSecured As IMsTscNonScriptable =
                DirectCast(rdpView.GetOcx(), IMsTscNonScriptable)
    
                isSecured.ClearTextPassword = txtPassWord.Text
    
                rdpView.Connect()
    
            Catch ex As Exception
    
                MessageBox.Show("Cannot Connect", "Cannot Connect to: " _
                + txtComputerName.Text + " Reason:  " + ex.Message,
                MessageBoxButtons.OK, MessageBoxIcon.Error)
    
            End Try
    I haven't done any coding for the size of the controls. I was using the "Anchor" and "Dock" options in the properties of the controls to have them position themselves. Do I need to do something manually outside of those settings for this control?

    Name:  rdp_2.jpg
Views: 427
Size:  33.8 KB

  4. #4
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: Terminal Services Client control not resizing

    I am thinking there are display properties to adjust the resolution. on ResizeEnd event maybe see if you can change the resolution of rdpView. I am quite sure there is documentation

  5. #5
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: Terminal Services Client control not resizing

    Try
    Code:
    RdpView.DesktopHeight = Height 'container height
    RdpView.DesktopWidth = Width 'container width
    RdpView.FullScreen = True

  6. #6

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    34

    Re: Terminal Services Client control not resizing

    Tried the following in the forms "size changed" and it didn't work.

    Code:
    RdpView.DesktopHeight = grpRdpView.Height
    RdpView.DesktopWidth = grpRdpView.Width
    RdpView.FullScreen = True
    Any suggestion of where else to place that code? From what i'm seeing after really looking at it, the control IS resizing (without this most recent code addition). However, the display of the remote desktop is not. Looking through the options for the control, there is a "refresh". I haven't been able to make that work though and i'm not entirely sure that's what it's for.

    This is my first venture into terminal services but it seems like it's just something to do with the session needing to be refreshed in some way. I'm looking for documentation on the Microsoft Terminal Services but haven't found the magic bullet just yet.

  7. #7

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    34

    Re: Terminal Services Client control not resizing

    So I tried to add rdpView.refresh() to the "rdpView_SizeChanged" to see if that would do what I need. No luck. Refresh doesn't seem to do what i'd expect. It just seems like something need to refresh to make the connection fill the entire area of the control. It just gets stuck in the size of the initial control even if I maximize the window.

    Not sure what step to take next.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width