Thursday, December 17, 2009

Windows Remote Desktop Web Connection ActiveX Reference

This articel help you understand how to use javascript create a customize windwos remote desktop web connection.
you can use this technic connect to your server desktop anywhere and the IE browser is all you need.
 
// Declare MsRdpClient object in the web page
    <OBJECT language="vbscript" ID="MsRdpClient" CLASSID="CLSID:7584c670-2274-4efb-b00b-d6aaba6d3850"
        onerror="OnControlLoadError"
        onreadystatechange="OnControlLoad"
        CODEBASE="msrdp.cab#version=5,2,3790,3959"
        WIDTH=<% resWidth = Request.QueryString("rW")
            if  resWidth < 200 or resWidth > 1600 then
               resWidth = 800
            end if
            Response.Write resWidth %>
        HEIGHT=<% resHeight = Request.QueryString("rH")
            if  resHeight < 200 or resHeight > 1200 then
               resHeight = 600
            end if
            Response.Write resHeight %>
    </OBJECT>
 
// Some Necessary input fields in web page
    Domain Name: <input type="text" name="Domain" id="editDomain">
    Screen Resolution:
    <select size="1" name="comboResolution" id=comboRes class="topspace">
        <option selected value="1"><ID id=option1>Full Screen</ID></option>
        <option value="2"><ID id=option2>640 x 480</ID></option>
        ....
        <option value="7"><ID id=option6>1600 x 1200</ID></option>
    </select>
   
    <input type="submit" id=connectbutton value="Connect" disabled="true" name="ButtonLogin" OnClick="RdpConnect">
 
// Validate MsRdpClient ActiveX is ready to load
    function onControlLoad
    {
       var control = document.getElementById("MsRdpClient");
       if(control == null)
       {
          if(control.readyState == 4)
          {
             document.getElementById("connectButton").disabled = false;
          }
       }
    }

// invok  connection to MsRdpClient object
function RdpConnect()
{
    MsRdpClient.Server="Server";
    MsRdpClient.Domain="Domain";
    MsRdpClient.UserName="user";
    MsRdpClient.AdvancedSettings2.ClearTextpassword="password";
    MsRdpClient.AdvancedSettings2.RDPPort = 3389;
    MsRdpClient.FullScreen=1;
    MsRdpClient.Width=1024;
    MsRdpClient.Height=768;
    MsRdpClient.DesktopWidth=1024;
    MsRdpClient.DesktopHeight=768;
    MsRdpClient.Connect();
}


MsRdpClient OCX Methods and controls reference:
    MsRdpClient.AdvancedSettings.PluginDlls
    MsRdpClient.AdvancedSettings2.AcceleratorPassthrough
    MsRdpClient.AdvancedSettings2.BitmapCacheSize
    MsRdpClient.AdvancedSettings2.BitmapPersistence
    MsRdpClient.AdvancedSettings2.BitmapVirtualCache16BppSize
    MsRdpClient.AdvancedSettings2.BitmapVirtualCache24BppSize
    MsRdpClient.AdvancedSettings2.BitmapVirtualCacheSize
    MsRdpClient.AdvancedSettings2.ClearTextPassword
    MsRdpClient.AdvancedSettings2.ConnectToServerConsole
    MsRdpClient.AdvancedSettings2.DedicatedTerminal
    MsRdpClient.AdvancedSettings2.DisableCtrlAltDel
    MsRdpClient.AdvancedSettings2.DisplayConnectionBar
    MsRdpClient.AdvancedSettings2.DoubleClickDetect
    MsRdpClient.AdvancedSettings2.EnableAutoReconnect
    MsRdpClient.AdvancedSettings2.EnableMouse
    MsRdpClient.AdvancedSettings2.EnableWindowsKey
    MsRdpClient.AdvancedSettings2.FullScreen
    MsRdpClient.AdvancedSettings2.GrabFocusOnConnect
    MsRdpClient.AdvancedSettings2.HotKeyAltEsc
    MsRdpClient.AdvancedSettings2.HotKeyAltShiftTab
    MsRdpClient.AdvancedSettings2.HotKeyAltSpace
    MsRdpClient.AdvancedSettings2.HotKeyAltTab
    MsRdpClient.AdvancedSettings2.HotKeyCtrlAltDel
    MsRdpClient.AdvancedSettings2.HotKeyCtrlEsc
    MsRdpClient.AdvancedSettings2.InputEventsAtOnce
    MsRdpClient.AdvancedSettings2.KeepAliveInterval
    MsRdpClient.AdvancedSettings2.KeyboardType
    MsRdpClient.AdvancedSettings2.MaxEventCount
    MsRdpClient.AdvancedSettings2.MaximizeShell
    MsRdpClient.AdvancedSettings2.MaxReconnectAttempts
    MsRdpClient.AdvancedSettings2.MinInputSendInterval
    MsRdpClient.AdvancedSettings2.MinutesToIdleTimeout
    MsRdpClient.AdvancedSettings2.NumBitmapCaches
    MsRdpClient.AdvancedSettings2.OrderDrawThreshold
    MsRdpClient.AdvancedSettings2.OverallConnectionTimeout
    MsRdpClient.AdvancedSettings2.PerformanceFlags
    MsRdpClient.AdvancedSettings2.PersistCacheDirectory
    MsRdpClient.AdvancedSettings2.PinConnectionBar
    MsRdpClient.AdvancedSettings2.RdpdrClipCleanTempDirString
    MsRdpClient.AdvancedSettings2.RdpdrClipPasteInfoString
    MsRdpClient.AdvancedSettings2.RdpdrLocalPrintingDocName
    MsRdpClient.AdvancedSettings2.RDPPort
    MsRdpClient.AdvancedSettings2.RedirectDrives
    MsRdpClient.AdvancedSettings2.RedirectPorts
    MsRdpClient.AdvancedSettings2.RedirectPrinters
    MsRdpClient.AdvancedSettings2.RedirectSmartCards
    MsRdpClient.AdvancedSettings2.ScaleBitmapCachesByBPP
    MsRdpClient.AdvancedSettings2.ShadowBitmap
    MsRdpClient.AdvancedSettings2.ShutdownTimeout
    MsRdpClient.AdvancedSettings2.SingleConnectionTimeout
    MsRdpClient.AdvancedSettings2.SmartSizing
    MsRdpClient.AdvancedSettings2.SmoothScroll
    MsRdpClient.AdvancedSettings3.ConnectionBarShowMinimizeButton
    MsRdpClient.AdvancedSettings3.ConnectionBarShowRestoreButton
    MsRdpClient.ColorDepth
    MsRdpClient.SecuredSettings.AudioRedirectionMode
    MsRdpClient.SecuredSettings.KeyboardHookMode
    MsRdpClient.SecuredSettings.StartProgram
    MsRdpClient.SecuredSettings.WorkDir


Related Links:
Installing Remote Desktop Web Connection in Windows XP