Friday, September 21, 2012

Setting start up position for Windows RDP Windows

I have an annoying situation where I create RDP windows and they seem to always start the same (but wrong) size. For example, one of my sessions starts "maximized" but only 1280x1024 sized so it ends up having scrollbars inside my 1920x1200 monitor. I then have to de-maximize it, move the window somewhere, and drag the corners to get it to the right size. Another one always starts up in a partial-sized window with scroll bars. When I drag to expand it, it snaps to the edge of the screen and Windows 7 tries to maximize it.

I figured out how to get them the way I like them. Start by editing the saved RDP file with a text editor that won't mess up the character encoding. (probably not Notepad or Wordpad.) Edit the 'winposstr' string. It looks like this:

winposstr:s:0,1,10,10,1708,1105

The values are

winposstr:s:0,windowState,xLeft,yTop,xRight,yBottom

I found that for a 1680x1050 window, I need to add 18 pixels to the width and 45 pixels to the height in Windows 7 to account for the borders. Then, you do the math for (x,y)+(width,height) to figure out the start position of the window and the right,bottom corner.

windowsState can be changed to control the initial maximized state of the window:
  • 1 - normal
  • 2 - unknown
  • 3 - maximized
Save the RDP file, then

That's it.