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 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.
Comment by Some Guy on November 14th, 2005 at 1:17 pm
1I’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
Comment by Andrew on December 2nd, 2005 at 12:44 pm
2Comment by Toby Simmons on December 2nd, 2005 at 1:09 pm
3Comment by Anonymous on August 2nd, 2006 at 9:50 am
4Comment by Niklas on August 31st, 2006 at 10:41 am
5Thanks a million!!!
Comment by RDC User on July 10th, 2007 at 11:33 am
6Comment by Tommy on July 11th, 2007 at 2:47 am
7It 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).
Comment by Dag Philip Lango Thorbjørnsen on March 5th, 2008 at 1:56 am
8I 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.
Comment by K.O. on September 2nd, 2008 at 8:57 am
9Comment by Toby Simmons on September 3rd, 2008 at 9:55 pm