Mobile Developement – RDP AutoLogin extended (version 4)


on the wish of the one or other user I extended the RDP AutoLogin code and we now reached level 4.

The new code simply has only one extension, it supports the color depth selection. Also the color depth and other settings are visible on the dialog of Remote Desktop Mobile, the settings itself are done via the Default.rdp file. But you are right, RDP_AutoLogin also controls some of the dialog items directly.

[codesyntax lang=”text”]



The color depth setting supports two modes, 8 Bit with 256b colors (ColorDepthID:i:1) and 16 Bit with ~65000 colors (ColorDepthID:i:3).

[codesyntax lang=”reg”]


"Save Password"="1"
"UseMouseClick"="0"	//added with version 3 to switch between mouse and keyboard simulation
"ColorDepth"=1		//added with version 4 to enable switching between 8 and 16 Bit colors


The code changes are small. Some code addition to read the value from the registry and some to write the rdp file:

[codesyntax lang=”cpp”]

void readReg(){
        //ColorDepth new with version 4
        if(RegReadDword(L"ColorDepth", &dwTemp) == 0)
void writeRDP(){
			else if(wcsstr(rdpLines[c].line, L"ColorDepthID")!=NULL){
				wsprintf(szTemp, rdpLines[c].line, dwColorDepth);  //3=HighColor(16Bit) or 1=(8Bit) color


Additionally I have added a new project to the solution to enable to set all the settings not only via the registry but using a GUI application. RDP_Autologin_Settings is born:


As you see, there is also a small file browser integrated. The default OpenFile dialog of Compact Framework does not allow you to browse all directories, but only “\My Documents”.

RDP AutoLogin Settings Editor (exe): [Download not found]
source (Visual Studio 2008 WM5 SDK project): [Download not found]

RDP_AutoLogin (exe): [Download not found]
source (Visual Studio 2008 WM5 SDK project): [Download not found]

RDP_KeepBusy (exe): [Download not found]
RDP_KeepBusy (vs2008 WM5 SDK project): [Download not found]

Have fun



  1. […] on version-4 here is an more extended version with the option to preset Resource mapping (Device storage and […]

  2. Olaf says:

    Hallo Josef,

    thank you for your great site to better understand RDP for WM6.x. You handle autologin and keep a RDP session alive. I am struggling with nearly the opposite problem. I start RDP client calling wpctsc.exe under the control of a local .NET-CF application. My local and remote application communicate via clipboard. That works fine. The problem: My local application does not recognize, when remote application and therefore RDP session is closed, because the wpctsc application keeps runnig with login screen. Even the “X” button doesn´t really terminates the wpctsc program. (I don´t understand that WM “feature”, to keep closed applications alive.)

    Before I had to switch to RDP, I had done the same job with citrix client. That client really terminates after use.

    Do you have any hint, how I can recognize, that wpctsc is finisched (and maybe the user pressed the X button on login screen)?

    Viele Grüße!

  3. admin says:


    you may simply check the window state of wpctsc window or the window title. If in start screen, the window class “TSSHELLWIN” has the window title “Remote Desktop Mobile”. The window title will change when RDM is connected. You need to pinvoke FindWindow() and GetWindowText().

    A tool to look for window titles is RemoteSpy by MS or WinTreeCE.


  4. Olaf says:

    Hello Josef,

    my summary: wpctsc is not very amusing.

    But with your help and the following way I could find the login screen, send a close (pinvoke of SendMessage). Afterwards a process wpctsc.exe has been left. I kill that one and my application is happy.

    //find and close window
    IntPtr ptr = FindWindow(null, “Remote Desktop Mobile”);
    if (ptr != IntPtr.Zero)SendMessage(ptr, WM_CLOSE, 0, 0);

    For finding the process I used a third party api, because I couldn´t find a built-in GetProcessesByName
    I killed the process with Process.Kill().

    Uncomfortable: Starting the client, the window title is “Remote Desktop Mobile”, too. So I have to wait a bit before I close it in order to allow the user to login to the ts server.


Leave a Reply