Click here to Skip to main content
12,626,508 members (37,688 online)
Click here to Skip to main content
Add your own
alternative version

Stats

579.8K views
49.1K downloads
296 bookmarked
Posted

Palantir - Remote Desktop Manager

, 6 Aug 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
Palantir is an application that allows users to manage remote desktop connections in one window. It also allows users to save existing connections for later use.
Screenshot - palantir.jpg

Screenshot - palantir3.jpg

Introduction

Palantir is an application that allows users to manage remote desktop connections in one window. It also allows users to save existing connections for later use.

Background

The remote desktop connections are managed with Microsoft RDP Client control. This control has all of the properties such as Server, UserName, Domain, etc. in order to set up a remote desktop connection. In addition to these properties, sharing printers, disk drives or color depth of the remote desktop can be managed via RDP Client control. Palantir enables users to create a remote desktop connection and save connection settings for later use. Users can also choose to start a remote desktop connection automatically when the application starts.

The settings can be saved into a file and restored from a setting file. Users can also connect to a computer via console. The application has a class named Machine that stores a remote desktop connection's properties. All of the remote connections created by user is stored in application's .settings file. This setting file has a property setting named MyMachine and its type is string. This property is converted into Hashtable while getting the settings. Palantir's solution consists of four projects which are GUI, Helper, BusinessObjects and a setup project.

Using the Code

The remote desktop connections are retrieved by the function below:

public List<Machine> GetRemoteDesktops()         
{             
    List<Machine> lstMachine = new List<Machine>();             
    if (Settings.Default.MyMachine != "")             
    {                 
        Hashtable ht = 
            (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine);
        foreach (DictionaryEntry de in ht)                     
        {                     
            Machine insMachine = (Machine)de.Value;                     
            lstMachine.Add(insMachine);                 
        }             
    }               
    lstMachine.Sort(delegate(Machine m1, Machine m2) 
    { 
        return m1.RemoteDesktopConnectionName.CompareTo(
            m2.RemoteDesktopConnectionName); 
    });             
    return lstMachine;         
} 

As seen in the code, this function deserializes the setting named MyMachine into a hashtable and inserts each dictionary entry in the hashtable into a list and returns the list. A remote desktop connection is saved and edited by the function below:

public bool SaveRemoteDesktop(Machine parMachine, bool openedForEdit)   
{             
    if (Settings.Default.MyMachine == "")
    {                 
        Hashtable ht = new Hashtable(); 
        Settings.Default.MyMachine = BinarySerializer.ToBinary(ht); 
        Settings.Default.Save();
    }             
    Hashtable ht1 = 
        (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine); 
    if (!parMachine.SavePassword) 
    {                 
        parMachine.Password = "";             
    }               
    if (!openedForEdit)             
    {                 
        foreach (DictionaryEntry de in ht1)                 
        {                     
            if (((Machine)de.Value).RemoteDesktopConnectionName == 
                parMachine.RemoteDesktopConnectionName)                     
            {                         
                MessageBox.Show("There is already a 
                                    remote connection with the same name.");                         
                return false;                     
            }                 
        }             
    }               
    ht1[parMachine.RemoteDesktopConnectionName] = parMachine; 
    Settings.Default.MyMachine = BinarySerializer.ToBinary(ht1);
    Settings.Default.Save(); 
    return true; 
}

If there's no currently saved remote desktop connection, we create a new hashtable and then serialize and save the settings file. After that, we deserialize the settings parameter into a hashtable and after checking if there's another connection with the same name, we save the remote desktop connection with the function's parameter Machine object. The methods below set the RDP Client control's settings and connect to the remote desktop which is passed as parameter.

private void SetRdpClientProperties(Machine parMachine)   
{             
    rdpc.Server = parMachine.MachineName;             
    rdpc.UserName = parMachine.UserName;             
    rdpc.Domain = parMachine.DomainName;             
    if (parMachine.Password != "")             
    {                 
        rdpc.AdvancedSettings5.ClearTextPassword = parMachine.Password;   
    }             
    rdpc.AdvancedSettings5.RedirectDrives = parMachine.ShareDiskDrives;     
    rdpc.AdvancedSettings5.RedirectPrinters = parMachine.SharePrinters; 
    rdpc.ColorDepth = (int)parMachine.ColorDepth;             
    rdpc.Dock = DockStyle.Fill;           
} 
public void Connect(Machine parMachine)         
{             
    SetRdpClientProperties(parMachine);             
    rdpc.Connect();         
}           
public void ConnectViaConsole(Machine parMachine)         
{             
    rdpc.AdvancedSettings5.ConnectToServerConsole = true;    
    SetRdpClientProperties(parMachine);        
    rdpc.Connect();         
} 

Feedback

For bug reports and suggestions, feel free to contact me at io1981@hotmail.com.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Isil Orhanel
Web Developer
Turkey Turkey
No Biography provided

You may also be interested in...

Comments and Discussions

 
AnswerRe: please clear my doubt... Pin
Jim Weiler19-Nov-08 19:33
memberJim Weiler19-Nov-08 19:33 
GeneralRe: please clear my doubt... Pin
Kevin James10-Feb-09 23:20
memberKevin James10-Feb-09 23:20 
Questionpocket pc version? Pin
Jeff Dafing17-Aug-08 9:10
memberJeff Dafing17-Aug-08 9:10 
QuestionBuild errors with VS 2005 Pin
curiousharry22-Sep-07 16:16
membercuriousharry22-Sep-07 16:16 
AnswerRe: Build errors with VS 2005 Pin
GrantS23-Oct-07 23:40
memberGrantS23-Oct-07 23:40 
GeneralGreat.. Pin
Murat Firat12-Sep-07 8:11
memberMurat Firat12-Sep-07 8:11 
QuestionQuery Pin
Rajendrakumara24-Aug-07 21:15
memberRajendrakumara24-Aug-07 21:15 
GeneralWorked at office, error at home Pin
zafer_arsay13-Aug-07 23:30
memberzafer_arsay13-Aug-07 23:30 
Hi Isil,

Palantir is a life-saving stuff and you've done a great job writing this. I used to use other SW for tabbed RDC functionality. But none of them allowed such great window area for use.

I'm using Palantir at work with no hassle. But after installing at home, I got the exception below:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040111): ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at System.Windows.Forms.TabPage.TabPageControlCollection.Add(Control value)
at Palantir.RemoteDesktopControllerTabPage.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at System.Windows.Forms.TabControl.ControlCollection.Add(Control value)
at System.Windows.Forms.TabControl.TabPageCollection.Add(TabPage value)
at Palantir.frmMain.LoadRemoteConnection(Machine parEntMachine, Boolean isConsole)
at Palantir.frmMain.LoadAutoConnectRemoteDesktops()
at Palantir.frmMain.frmMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Palantir
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Palantir/Palantir/Palantir.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
BusinessObjects
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Palantir/Palantir/BusinessObjects.DLL
----------------------------------------
Helper
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Palantir/Palantir/Helper.DLL
----------------------------------------
AxInterop.MSTSCLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Palantir/Palantir/AxInterop.MSTSCLib.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Do you have any suggestion regarding this problem?

Thank you.

Zafer
QuestionWhat is in this name? Pin
SAKryukov9-Aug-07 13:02
memberSAKryukov9-Aug-07 13:02 
AnswerRe: What is in this name? Pin
Sacha Barber9-Aug-07 21:48
memberSacha Barber9-Aug-07 21:48 
AnswerRe: What is in this name? Pin
pauljenkins71425-Mar-10 23:20
memberpauljenkins71425-Mar-10 23:20 
GeneralAlready better than MS RDP client, yet needs improvements [modified] Pin
SAKryukov9-Aug-07 13:00
memberSAKryukov9-Aug-07 13:00 
GeneralSome fix... [modified] Pin
cacalex8-Aug-07 4:07
membercacalex8-Aug-07 4:07 
Generalcool improvement... Pin
cacalex7-Aug-07 7:26
membercacalex7-Aug-07 7:26 
NewsClipboard support Pin
Vance Kessler7-Aug-07 6:24
memberVance Kessler7-Aug-07 6:24 
GeneralGood job and ... good name Pin
Crusty Applesniffer7-Aug-07 1:22
memberCrusty Applesniffer7-Aug-07 1:22 
GeneralHave you seen.... Pin
Peter Tewkesbury7-Aug-07 0:01
memberPeter Tewkesbury7-Aug-07 0:01 
AnswerRe: Have you seen.... PinPopular
Isil Orhanel7-Aug-07 0:32
memberIsil Orhanel7-Aug-07 0:32 
GeneralRe: Have you seen.... Pin
Vishal.Doshi7-Aug-07 6:25
memberVishal.Doshi7-Aug-07 6:25 
GeneralRe: Have you seen.... Pin
dherv1-Oct-07 10:17
memberdherv1-Oct-07 10:17 
GeneralRe: Have you seen.... Pin
Danilo Corallo19-Oct-07 2:19
memberDanilo Corallo19-Oct-07 2:19 
QuestionAnother exception, do I need TSC 6.0? Pin
NickViz6-Aug-07 22:31
memberNickViz6-Aug-07 22:31 
AnswerRe: Another exception, do I need TSC 6.0? Pin
Isil Orhanel7-Aug-07 0:14
memberIsil Orhanel7-Aug-07 0:14 
GeneralRe: Another exception, do I need TSC 6.0? Pin
liangpz_200013-Sep-07 20:38
memberliangpz_200013-Sep-07 20:38 
AnswerRe: Another exception, do I need TSC 6.0? Pin
Carlos Solorzano6-Mar-08 11:27
memberCarlos Solorzano6-Mar-08 11:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161205.3 | Last Updated 7 Aug 2007
Article Copyright 2007 by Isil Orhanel
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid