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:
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. :)
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
All I can say is AMEN, BROTHER. (And thanks for the other tips!)
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.
Wow, what a fidgety so and so. If you’re trying to do negative coords, for a 2nd monitor on the left, you have to be sure you don’t make the window go even 1 pixel beyond that monitor or the whole window will move to 0x0 on your main screen. What makes this particularly tricky is that working out the numbers on your main monitor is misleading as you can make the last two (right side, and bottom) bigger than they should and it works fine. That same “who cares” factor screws up your negative position. You really need to be exact, which is tricky because the window size needed includes the borders!
What I did was to manually extend the RDP window so there weren’t any scroll bars, hit alt+PrtScn to screenshot just that window and pasted it into my paint program (Pain Shop Pro) as a new image. Then I could see exactly what size the window needed to be. Here’s the details for what I was doing:
Main monitor was on the right of the 2nd monitor
Remote screen resolution: 950×864
Window size without scroll bars: 964×902
RDP position on 2nd (left) screen: Flush against the top and right of the screen (space on left and bottom)
Here’s the line that did it:
winposstr:s:0,1,-964,0,0,902
Hope that saves someone spending 20 minutes working that out :)
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!!!!!!
Thanks to all contributions here my frustrations with RDC and monitor positioning have ended.
Thanks a million!!!
Thank you, i love you :-D
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).
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.
Wow. And only nearly 3 years later … here’s an official word.
Hey thanks for this info!
Writting an application “Multi Remote Desktop Client .NET (Open Source)” and adding a new feature of reading RDP Files
You can download “Multi Remote Desktop Client .NET (Open Source)” at CodePlex
http://multirdpc.codeplex.com/
I just wanted to add that it’s actually possible to save the position without directly hacking the .rdp file…
The trick is to get Remote Desktop Connection to return to the Options and Logon settings dialog (whereupon you get the chance to Save or Save As… – of course after you’ve manipulated the window position during the session).
First of all, if you have a pre-existing .rdp, either right-click and Edit or load RDC and Open… to load the settings for that session.
On the Experience tab, temporarily disable ‘Reconnect if the connection is dropped’ (you can re-enable this later). Press the Connect button to establish the session and place your window.
Then, you need to somehow disable the Internet connection (e.g. kill the ssh tunnel, disconnect the VPN or LAN etc.) This causes RDC to error and return to the dialog. (Logging off or simply disconnecting the session doesn’t seem to do this.) Now that you’re back to the session settings, re-enable ‘Reconnect if the connection is dropped’ if necessary and Save the .rdp. The .rdp now has the proper winposstr line.
I am Drool-ing Drool!!
That not only fixed my RDP monitor positioning (display RDP in Monitor 2 / second mionitor) but also allowed me to save my password on the .RDP file! Great!!!! Thanks!
Brilliant Drool. This had been niggling me for months. Thanks very much.
Wow Drool, you rock man. This worked like a charm. I honestly didn’t think it would.
Not sure how or why but this is the best solution, sorry to OP but I don’t like that setting, because it sticks the rdp window in the upper left of my monitor.
Thanks a TON for the tip about editing the winposstr, Andrew! Thanks to you I now have my remote desktop session loading full screen on my second display just like I always wanted. :)
My problem has been partially solved by this, but I still can’t quite get what I need. I have 3 monitors, each is 1600X1200. I would like to use two of my three for the remote session. So I have set the width to 3200 and the height to 1200. The part that this thread helped with was getting the RDP session to open on my 2nd monitor (the middle one). But I would like it to also use the third monitor as well. I have tried various combinations of values, but it always maximizes on the second monitor and will not expand to the third monitor. Any Ideas?
try this out for spanned accross multiple monitors
http://www.splitview.com/using-remote-desktop-with-dual-monitors-in-span-mode
I’m still struggling with movement.
If you move the RDP window in Win 7 after the changes, it goes back to a non-maximised window.
Being able to move and position the windows by hand is an important requirement here, so I’m guessing the *only* way to do this without the scrolls is to enlarge the size by the width of the scrolls.
Ah, maybe I spoke to soon, once I’d correctly named the resolution of *my* monitor, it was fine with it.