Tuesday, March 10, 2015

Add Multi Monitor Support to RDWeb

When a user connects to RDWeb and uses the "Connect to a remote PC" link, the resultant RDP session only uses a single monitor. Many of my users have expressed the desire to use both of their monitors when working from home. Out of the box, there is not a way to use multiple monitors on the RDP session. This post will show you how to modify the RDWeb files to add support for multiple monitors.

We'll add the option to enable multi-monitor support to the Options section of the Desktops.aspx page, as shown below.

After adding multiple monitor support to RDWeb
After adding multiple monitor support to RDWeb



Defining the localized text


First we need to define the text that will actually display on the page. Start by browsing to C:\Windows\Web\RDWeb\Pages\en-us\ and open Desktops.aspx in your text editor of choice. At the top of the file, locate the Localizable Text section near line 20 of the file and add the following three lines:
const string L_DisplaySettings_Text = "Display settings";
const string L_MultiMon_Text = "Use all my <u>m</u>onitors for the remote session";
const string L_MultiMonAccessKey_Text = "m";

Adding the form elements to the page


Next, we'll need to add the actual page elements that will display the form. In the document, search for the following section of code:

<!-- ******************** Hidden Row for 'Additional Options' ******************** -->
<tr>
    <td>
        <table cellpadding="0" cellspacing="0" border="0"  id="opt_panel" style="visibility: hidden;">

Add the following block of code immediately after:

<tr>
    <td><b><%=L_DisplaySettings_Text%></b></td>
</tr>
<tr height="7">
    <td></td>
</tr>
<tr>
    <td>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td width="7" align="left" valign="top"><input type="checkbox" value="OFF" id="xMultiMon" name="xMultiMon"/></td>
                <td width="7"></td>
                <td><label accesskey="<%=L_MultiMonAccessKey_Text %>" for="xMultiMon"><%=L_MultiMon_Text %></label></td>
            </tr>
        </table>
    </td>
</tr>
<tr height="20">
    <td></td>
</tr>

Adding the multi-monitor code to the RDP file 


The last modification we need to make will actually set the multiple monitor mode depending on whether the user has selected the option to use all monitors. We'll be invoking the use multimon setting of the RDP protocol.

In the file, search for the following line of code:
RDPstr += "autoreconnection enabled:i:1\n";
On the next line, add the the following line of code:
RDPstr += "use multimon:i:" + GetParam("xMultiMon", false, "0") + "\n";
That's it! Save the Desktops.aspx file and log into RDWeb to verify the functionality is working as anticipated.

No comments:

Post a Comment