// for example, I have my AxMsRdpClient control named rdpClient.
rdpClient.Server = "sever name here";
rdpClient.UserName = "your username on remote pc";
rdpClient.AdvancedSettings2.ClearTextPassword = "you password on remote pc";
// optional
rdpClient.ColorDepth = 16; // int value can be 8, 15, 16, or 24
rdpClient.DesktopWidth = 1024; // int value
rdpClient.DesktopHeight = 768; // int value
rdpClient.FullScreen = true|false; // boolean value that can be True or False
// and connect
rdpClient.Connect();
A simple example code on RDP connection to remote desktop
just set the Fullsceen property to TRUE
rdpClient.Fullscreen = true;
// strecth the screen
rdpClient.AdvanceSettings3.SmartSizing = true;
/*
Author: Jayson Ragasa
Application Developer
* ---
* RDPFileReader 1.0
*
* RDP File Settings - http://dev.remotenetworktechnology.com/ts/rdpfile.htm
* Terminal Services Team Blog - http://blogs.msdn.com/ts/archive/2008/09/02/specifying-the-ts-client-start-location-on-the-virtual-desktop.aspx
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace RDPFileReader
{
public class RDPFile
{
#region enum
public enum KeyboardHooks
{
ON_THE_LOCAL_COMPUTER = 0,
ON_THE_REMOTE_COMPUTER = 1,
IN_FULL_SCREEN_MODE_ONLY = 2
};
public enum AudioModes
{
BRING_TO_THIS_COMPUTER = 0,
DO_NOT_PLAY = 1,
LeAVE_AT_REMOTE_COMOPUTER = 2
};
public enum WindowState : int
{
NORMAL = 1,
MAXMIZE = 3
}
public enum SessionBPPs
{
BPP_8 = 8,
BPP_15 = 15,
BPP_16 = 16,
BPP_24 = 24
}
#endregion
#region structs
public struct RECT
{
public int Top;
public int Left;
public int Width;
public int Height;
}
public struct WindowsPosition
{
public WindowState WinState;
public RECT Rect;
}
#endregion
#region variables
private string _filename = string.Empty;
#region RDP template
string[] _rdpTemplate = {
"screen mode id:i:{0}",
"desktopwidth:i:{1}",
"desktopheight:i:{2}",
"session bpp:i:{3}",
"winposstr:s:0,{4},{5},{6},{7},{8}",
"full address:s:{9}",
"compression:i:{10}",
"keyboardhook:i:{11}",
"audiomode:i:{12}",
"redirectdrives:i:{13}",
"redirectprinters:i:{14}",
"redirectcomports:i:{15}",
"redirectsmartcards:i:{16}",
"displayconnectionbar:i:{17}",
"autoreconnection enabled:i:{18}",
"username:s:{19}",
"domain:s:{20}",
"alternate shell:s:{21}",
"shell working directory:s:{22}",
"password 51:b:{23}",
"disable wallpaper:i:{24}",
"disable full window drag:i:{25}",
"disable menu anims:i:{26}",
"disable themes:i:{27}",
"disable cursor setting:i:{28}",
"bitmapcachepersistenable:i:{29}"
};
#endregion
#region member fields
int _screenMode = 0;
int _desktopWidth = 0;
int _desktopHeight = 0;
SessionBPPs _sessionBPP = 0;
WindowsPosition _winPosStr;
string _fullAddress = string.Empty;
int _compression = 0;
KeyboardHooks _keyboardHook = 0;
AudioModes _audiomode = 0;
int _redirectDrives = 0;
int _redirectPrinters = 0;
int _redirectComPorts = 0;
int _redirectSmartCards = 0;
int _displayConnectionBar = 0;
int _autoReconnectionEnabled = 0;
string _username = string.Empty;
string _domain = string.Empty;
string _alternateShell = string.Empty;
string _shellWorkingDirectory = string.Empty;
string _password = string.Empty;
int _disableWallpaper = 0;
int _disableFullWindowDrag = 0;
int _disableMenuAnims = 0;
int _disableThemes = 0;
int _disableCursorSettings = 0;
int _bitmapCachePersistEnable = 0;
#endregion
#endregion
#region properties
public int ScreenMode
{
get
{
return this._screenMode;
}
set
{
this._screenMode = value;
}
}
public int DesktopWidth
{
get
{
return this._desktopWidth;
}
set
{
this._desktopWidth = value;
}
}
public int DesktopHeight
{
get
{
return this._desktopHeight;
}
set
{
this._desktopHeight = value;
}
}
public SessionBPPs SessionBPP
{
get
{
return this._sessionBPP;
}
set
{
this._sessionBPP = value;
}
}
public WindowsPosition WinPosStr
{
get
{
return this._winPosStr;
}
set
{
this._winPosStr = value;
}
}
public string FullAddress
{
get
{
return this._fullAddress;
}
set
{
this._fullAddress = value;
}
}
public int Compression
{
get
{
return this._compression;
}
set
{
this._compression = value;
}
}
public KeyboardHooks KeyboardHook
{
get
{
return this._keyboardHook;
}
set
{
this._keyboardHook = value;
}
}
public AudioModes AudioMode
{
get
{
return this._audiomode;
}
set
{
this._audiomode = value;
}
}
public int RedirectDrives
{
get
{
return this._redirectDrives;
}
set
{
this._redirectDrives = value;
}
}
public int RedirectPrinters
{
get
{
return this._redirectPrinters;
}
set
{
this._redirectPrinters = value;
}
}
public int RedirectComPorts
{
get
{
return this._redirectComPorts;
}
set
{
this._redirectComPorts = value;
}
}
public int RedirectSmartCards
{
get
{
return this._redirectSmartCards;
}
set
{
this._redirectSmartCards = value;
}
}
public int DisplayConnectionBar
{
get
{
return this._displayConnectionBar;
}
set
{
this._displayConnectionBar = value;
}
}
public int AutoReconnectionEnabled
{