January 23, 2009 / original link

Remote Desktop (RDP) window state

I frequently use saved Remote Desktop connections (RDP) to manage our Windows servers. It can get confusing when you save a connection to open in Full Screen mode (plus, it can screw up icon placement on the console of the server if you run a different resolution on your workstation than on the server) so I typically save my RDP files to open a 1024 x 768 window. One of the problems I ran into is that some of my saved connections wouldn’t immediately open in a maximized window state so I would have to either click the maximize button or scroll the window to see the entire desktop. However, some of my connections did open up maximized. This puzzled me.

I went through all of the settings on the Display tab, comparing one that opened maximized and one that didn’t, and they appeared to be identical. I started changing things trying to nudge it, but nothing I did made any difference.

So then I started examining the files in a text editor and found the fix. You have to edit the RDP file by hand, but make sure you use a text editor that will not munge the two-byte Unicode header (0xFF 0xFE) at the beginning of the file, or it will turn into an invalid RDP file. Open the saved connection and find the line that references the winposstr and make sure the second digit is a 3. So, for example, if the line looks like this:

winposstr:s:0,1,0,0,1024,768

Change the 1 to a 3 like this:

winposstr:s:0,3,0,0,1024,768

Here is a visual showing the difference between the two window states:

The top is not maximized, the bottom is

This entry was posted on Monday, September 26th, 2005 at 1:04 pm and is filed under Technical. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
 

 

10 Responses

  1. Thanks! I found your post through Google and was also annoyed by how the RDP Client deals with window states. The MSDN article (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowstructures/windowpos.asp) confused me even more.

    The odd behavior I experienced was that if the desktop is 1280 x 960 and the RDP client is 1024 x 768, the client will forget the window position when you minimize/maximize and will always shove the window to the top-left of the screen. The solution is to _not_ have the window maximized while having it large enough to not show the scroll bars. :)

    1
  2. Hi Toby!

    I’ve suffered from similar annoyance for over a year and now finally had the time to look into this as well. I’ve started monkeying around with the RDP files and found out that you can achieve the same effect you describe by changing the “screen mode id” setting from 1 to 2. The latter corresponds to a full screen mode.

    I also faced another frustrating tidbit. I have dual monitors and I wanted all my remote desktop sessions to open on the right monitor. Unfortunately, they seemed to have a mind of their own. Some of them consistently opened on the right, but some others would insist on sticking to the left monitor. It turns out that the screen the session lands on depends on the settings in winposstr. This string represents the location of the session window. It’s still not clear to me what the first two numbers mean in there, but the next four correpsond to (contrary to Microsoft’s documentation) the left, top, right and bottom edges of the window. If these coordinates place the window on screen 1 then it will appear there also when it’s maximized. The same holds for screen 2. In other words, if you want the session window to be maximized on the second screen and your first screen is, say, 1280 pixels wide, then you need to make sure the left edge of your session window is set to x >= 1280.

    Wouldn’t it be nice if you could change this setting via the settings dialog box? Or at least documented thoroughly somewhere? ;-)

    Andrew

    2
  3. All I can say is AMEN, BROTHER. (And thanks for the other tips!) 3
  4. Your coordinates assume you have the desktop extended such that the second monitor is on the right. The coordinates used seem to extend naturally from (0,0) being the home coordinate of the first monitor; e.g., with the second monitor on the left, to get a display on the second monitor, you need a negative x coordinate. 4
  5. I did also found this post through google.. Just want to say thank you thank you thank you thank you thank you for everyones countributions!!!!!! 5
  6. Thanks to all contributions here my frustrations with RDC and monitor positioning have ended.

    Thanks a million!!!

    6
  7. Thank you, i love you :-D 7
  8. I to, found this site from google, and it solved my problem! :D
    It realy nags me to manually position 3 terminals over 3 different monitors every day.. :-§
    But now, that problem is gone!

    And just as a sidenote regarding editors:
    I used notepad++ and it worked like a charm! (I usually use this editor for other stuff as well).

    8
  9. hi
    I try to use msrdp ocx (MSRdpClient) programatically using MSVC6.0++.
    I use IWebBrowser2 and Navigat methode to call a java script embedded in html
    that download register and exec the OCX client , then I connect it.

    When It is opened in full screen (theater mode) the Rmote Desk Top detache its
    Display Context (or canvas, I don’t know what is the name of the disply of RDP WEB Client)
    but when it closes the web browser Window remain open. I tryed to Dispatch the OnDisconnected event (I am using JavaScript Object instantiation and connection) using Java Script I don’t recieve any event to launch the javascript callback function.

    can any body help me to learn how to attach the OnDisconnected Event using JavaScript (like it is done with VBScript in the MSRDP.OCX redistributed MSRdpClient_OnDisconnected()).
    TX.
    K.O.

    9
  10. Wow. And only nearly 3 years later … here’s an official word.