Automated Login for Remote Desktop Mobile II

Update 18. nov 2011: fixed some bugs, as mentioned by Patrick S. (great to see, that some take and use the code):

  • screen_width and height for WriteRDP()
  • read FitToScreen from reg in readReg()
  • check for already running process of startOnExit in startTSC(). Although I think check for running a process multiple times should be done in the target process.

Update 16. may 2011: converted code for VS2008(windows mobile 6 sdk), see Downloads at bottom

UPDATE 23 june 2010: new registry option to switch between MouseClick and Keyboard simulation:

"Save Password"="1"
"UseMouseClick"="0"    //added with version 3 to switch between mouse and keyboard simulation


Some days ago I published my RDP_Autologin code: RDP_Autologin

As there were some screen metrics hardcoded and more and more devices come with a VGA screen the hardcoded QVGA values will not match. So I extended the first version and implemented some additional logic and settings.

First, the emulated screen tap has been adjusted to depend on the device screen width and height. For that I included the HIRES_AWARE resource to get the real screen size.

	DWORD dX = (0xFFFF / iScreenWidth) * (80); // changed from 13 to width=240, 1/3=80
	DWORD dY = (0xFFFF / iScreenHeight) * (iScreenHeight - 13);
BOOL getScreenSize(){
	int iScreenX = GetSystemMetrics(SM_CXSCREEN);
	int iScreenY = GetSystemMetrics(SM_CYSCREEN);
	DEBUGMSG(1, (L"\ngetScreenSize: x=%i, y=%i\n", iScreenX, iScreenY));
	if(iScreenX+iScreenY > 0){
		_itow(iScreenWidth, sScreenWidth, 10);
		_itow(iScreenHeight, sScreenHeight, 10);
		return TRUE;
		return FALSE;

The rdp file defaults for desktop width and height will also be calculated but you can set the default to use via the registry.


"startOnExit"="\Windows\rdp_keepbusy.exe" "DesktopHeight"=dword:000001E0 "DesktopWidth"=dword:00000280
"Save Password"="1"

As you can see, I added a line where you can specify an application that will be started at the end of the autoconnect process: startOnExit.


evc4 source code: [Download not found]

Armv4i executable: [Download not found]

NEW: Version 3 adds new option to let the app use MouseClick or Keyboard Simulation

Update 18. nov 2011: [Download not found]

Exe File (ArmV4i) [Download not found]

eVC4 source code [Download not found]

NEW: VS2008 code and exe [Download not found]

Update 4.march 2011: Please also see about idle timeout



  1. sound_thunder says:

    Dear sir,

    thanks a lot for this useful program.
    I’m just wondering regarding the program to launch on server side.
    having tested the exe , the terminal server emulation try to start “\\rdp_keepbusy.exe”
    how the path work here and how should we key data in, as the terminal server should receive a “c:\…\program.exe” format?

    thanks in advance for your help

  2. admin says:

    Hi there

    rdp_keepbusy is not an app to run on server side. The idle timeout is fired, when there is no activity on the client side. To overcome this, rdp_keppbusy simulates mouse movement on the client side.


  3. sound_thunder says:

    OK thanks for your answer.
    You don’t provide this rdp_keepBusy, right? neither as EXE file or source code?

  4. Alex says:

    Thanks a lot, nice programm.
    On default rdp_autologin runs RDP in 256 colors mode.
    I think “Color depth” option may be very usefull.
    Please, add “Color depth” in registry.

  5. Mike M says:


    Thanks for the program!
    I’m running WM 6.1 on a CK3, and I’m having trouble with the “FitToScreen” regkey. It doesn’t seem to pick it up/apply it in RDC. Everything else seems to be working.

    Note: I’m not using DesktopHeight and DesktopWidth if that matters.

  6. admin says:

    I am currently busy with other things and cant take look at this.

    As the source code is provided you may add that yourself.

    Maybe I have the time to look at that month.

  7. Gary B says:

    Could you please explain how to use tscdialog or how to call scantscwindow? I cannot find a scantscdialog function. I believe that for WM6.1, the FitToScreen is on a separate sub form and the controlid may need additional qualification. Is there a compiled version of tscdialog?

  8. admin says:

    AFAIK the “Fit remote desktop to screen” option is on the same screen as the “Full Screen” option. There is only another Resources tab in RemoteDesktopMobile options dialog.
    If you dont know how to use scantscdialog nor scantscwindow then start with zDump. zDump enables you to drag and drop a cursor onto a dialog/window you need information about.

  9. Gary B says:

    You are correct. I am using WM6.1 and Both Full Screen and Fit Remote Desktop To Screen are on the same screen. FullScreen works but FitToScreen does not when using AutoLogin. I am trying to learn the correct ControlID for FitToScreen since this is the last thing I need to get working before I can go forward. I tried to find zDump, but all I found was a reference to a TimeZone program. I do not have a C++ compiler. Have you considered adding the keepbusy solution into the autologin?

  10. Gary B says:

    I found the source for zDump on this very site and was able to compile it. Unfortunately, the ID: field shows that the Fit remote desktop to screen is 1011. I tried that setting in the registry but that checkbox is still not being checked. I am pretty sure the idea behind “startOnExit”=”\Windows\rdp_keepbusy.exe” was to merge the two applications into one. Has anybody gotten this FitToScreen to work?

  11. Milton Cahipuendo says:

    I need a RDP with print redirection. Your RDP it?

  12. Milton Cahipuendo says:

    Ahha in Windows Mobile 6.1 profesional

  13. admin says:

    Hello Milton

    as you found yourself, this is not about a custom RDP client. This post is about a tool to automate the login of the existing windows mobile 6.1 RDP client.
    BTW: as WM does not support any type of printing, a redirection does not make sense.



  14. Milton Cahipuendo says:

    Thanks Josep:

    What is your recommendation to access via RDP and print locally?

  15. josef says:

    You cannot have a printer connected to your windows mobile device to print from inside a RDP client session.

    You may print on any printer installed and configured in your remote session. But these printers are in any way connected to the terminal server or remote PC.

    Windows Mobile does not support system wide printer drivers. There are only some specialized printing applications like PrinterCE that support printing of some file types to a limited number of printer types.

    To be able to print locally from a windows terminal service client session the OS must provide a windows driver. And this is not possible on windows mobile. There are NO Windows Mobile printer drivers.

  16. Gary B says:

    I have configured a PC to allow me to compile EVC4 and when I attempt to compile the v3 source, I get the following compile errors

    C:\Documents and Settings\XPMUser\My Documents\Visual Studio 2005\Projects\TSC_ALV3\WinTools.cpp(14) : error C2065: ‘scanWindow’ : undeclared identifier
    C:\Documents and Settings\XPMUser\My Documents\Visual Studio 2005\Projects\TSC_ALV3\WinTools.cpp(182) : error C2365: ‘scanWindow’ : redefinition; previous definition was a ‘data variable’

    I looked at the scanWindow function and it appears to call itself. Is this supposed to be a recursive function? Any suggestions on how to fix these errors?

  17. admin says:


    why do you have a line saying “Visual Studio 2005”? It is OK to use Visual Studio 2005 to compile RDP_AutoLogin.

    Such error msg as in line 1 will occur when the compiler cannot find the definition for a function name (here: scanWindow). The compiler then assumes simply an int for the function name.

    a) have you changed the files included for the build?

    b) What are the ProjectSettings for C++/PrecomiledHeaders? I used “not using precomiled headers”

    c) scanWindow is part of a file (wintools.h/wintools.cpp) included in the archive but not used for the app. In the app I use “scanTscWindow” to look for the TSC window and its child windows. Both functions are used recursive to iterate thru all child windows of a given window handle.



  18. Chris says:

    I have taken the source code as I have been unable to get the registry to work for Fit To screen and 16 Bit High colors. When I compile the source code with no changes it is not reading any the registry’s like the exe does. If I make the hard code change for all the reg settings and hard code the fit to screen and 16 bit colors it works perfectly. But I do not understand why, even with no changes, when I compile the source code it is not reading the reg but writing it based on the hard code. Is this the most up to date code? Or is there something that I am missing? I am currently working a CS40.

  19. admin says:

    Hello Chris

    the registry values for FitStoScreen and HighColor are used by RDPautilogin only. “Remote Desktop Mobile” (RDM) will use the values defined in \Windows\Default.rdp as for some other values. So RDPautologin writes a RDP file based on RDPautologin regsitry settings to be used by RDM (see code for writeRDP()).

    About compilation of RDPautologin:
    If you compile with the symbol DEBUG defined, the code will write default registry values! This is be design of the code. For example, see startTSC() code in tscDialog.cpp:
    int startTSC()

    LRESULT lRes=0;
    #ifdef DEBUG
    writeReg(); //write default settings to reg

    This #ifdef tests for the symbol (or define) DEBUG and if found, will compile the code writeReg(). If you switch your development environment to a RELEASE configuration, the line will not be compiled into the code.

    This are basic C/C++ compiler switches.



  20. Chris says:

    Thanks Josef, I have it working perfectly now.

  21. Greg says:

    Hoping one of you can help me.. maybe I am just confused as to the process but the FitToScreen option will not stay for me. Thanks

  22. Valentin says:

    Hi, Josef
    Is it possible to use your solution together with this one?
    I am not a good coder to merge code of the both solutions, could you please give a hint?

  23. admin says:

    Yes, you can use it with Raffael’s tool.

  24. josef says:

    Hello Valentin

    you can simply use Raffael’s solution and compile it separately from this here. Then use the registry to let my code know how to start Raffael’s code. Just use the startOnExit entry of the registry.



  25. jordy says:

    Hello Josef,

    Can you help me with the following issue:

    our customer is now using a CK31 with remote desktop connection. We are looking to replace all the CK31 terminals for CK71.
    But as mentioned above we have the “standard” rdp issues with Windows Mobile 6.x.

    We need to have a executable which can autologin, use the full-screen mode etc.. The above file seems to work but we have the problem that the application is designed for the CK31 screen (QVGA). Now we are using the VGA screen so everything is smaller when logged in. Is this something which can be configured at the client side, or does the customer needs to adjust the screens?



  26. admin says:

    Hello Jordy

    the customer has to redesign the screens for VGA.


  27. jordy says:


    thank you for the response.


  28. Daniel says:

    Hi, I am testing this on a Honeywell Dolphin 6000 running Windows Mobile Embedded 6.5.
    I have two problems: “Fit remote desktop to screen” is not checked although it is set to 1 in the reg file and “Colors” are always set to “256 Colors” instead of “High Color (16 bit)”.

    Can you help me?


  29. alex says:

    Great tool.

    I do have an issue with it though. Sometimes, it won’t connect after a disconnection. I have to end the “RDP” task manually in task manager to make it work,

    Can you please help me on this one? I really need it for my project.

    Thanks in advance.

  30. alex says:

    Forgot to mention, I am uning WM6.5 on Intermec CK71

  31. admin says:

    Looking at the source code you should see, that the main function startTSC also uses calls to startRDM, the latter one already tries to close and restart a new RDM session by killing the exe. Can you debug this to see where it fails to kill the RDM process?

  32. stijn says:

    Hi, is this working on a WinCE 5.0 device?

  33. admin says:

    Yes, it has no direct AYGSHELL dependencies.

  34. […] is just a note to let you know that “Automated Login for Remote Desktop Mobile II” post has been […]

  35. alexanko says:

    tell me please where to write the code to the option “Fit remote desktop to screen” was always installed by default. I tried to prescribe in the registry – did not help.

  36. admin says:


    I am sorry, but I cant actually spent any time at such questions.

    Beside that, I do not understand your english. Possibly you can write simple, short sentences.



  37. alexanko says:

    Josef, thanks for the answer. I very badly know English.
    “Fit remote desktop to screen” – options in the RDM.
    I want set this options as default.
    All version RDP_autologin.exe not set this option as default.
    I edit the registry…

    “Save Password”=”1”

    and search in all versions of source code lines or parameters responsible for this. Without result.
    It is not urgent, but if you can – Help me please.

  38. admin says:

    There is no single setting that is responsible for this dialog option called “Fit remote desktop to screen”.

    Just look at your \windows\default.rdp:
    without “Fit remote…” checked mine is:

    with “Fit remote…” checked mine is:

    You need to change the code lines
    if(g_bUseFitToScreen) //3=FullScreen or 1=normal
    wsprintf(szTemp, rdpLines[c].line, sScreenHeight /* L"320" */);
    wsprintf(szTemp, rdpLines[c].line, sDesktopHeight);// L"640");

    else if(wcsstr(rdpLines[c].line, L"DesktopWidth")!=NULL)

    if(g_bUseFitToScreen) //3=FullScreen or 1=normal
    wsprintf(szTemp, rdpLines[c].line, sScreenWidth /* L"240" */);
    wsprintf(szTemp, rdpLines[c].line, sDesktopWidth);// L"480");

    in tscDialog.cpp to fit your needs.

    See also the comment //0=no fullscreen + no fit, 1= fit to screen+no fullscreen, 2=fullscreen+no fit, 3=fit+fullscreen in this source file.



  39. Serge says:

    I stumbled onto this code while searching for an automated login solution for Windows CE 5.0. I haven’t done any Windows mobile programming in the past so a lot of this is Martian to me.

    Is this code for mobile PC only or can it be implemented with regular Windows CE running cetsc? I downloaded the source code and tried to compile it but wasn’t sure what is required to actually run it. Is it just a matter of having the exe and reg files or do they need to be saved to a specific location?

  40. admin says:

    Hello Serge

    this code/tool is not for Windows CE devices as these have a remote desktop client that allows auto-login of-the-shelf.
    On windows ce, you can call the remote desktop application with an rdp file of your choice and it should automatically connect to the server. AFAIR there is an extra option in the remote desktop application on windows ce that enables auto-login.

    Furthermore the exe files afor remote desktop of CE and Mobile are different and so this code/tool will not work on CE.



  41. Serge says:

    Any idea wow hard would it be to modify this code to work on a Win CE system?

    The image that we are running on Win CE has save password option disabled via registry and manufacturer isn’t willing to provide the base image that we can modify.

  42. admin says:

    Hello Serge

    remote desktop mobile (RDM) is different to terminal service client (TSC) on CE. My code uses rdp file, fills out the connect dialog and simulates a connect click. The auto-fill is strongly dependent on the dialog, as it uses hardcoded dialog element IDs of the given application.

    So, to rwrite the code for CE, one has to check the dialog IDs and change the code to match them on the target system. Without having a test device, that maybe hard to implement and debug.

    Possible other approach is to replace the TSC on the CE 5 device with one having the SavePassword option enabled.

    Please tell model manufactorer and type, if you need further assistance.



  43. Alex says:

    Link to latest version, could not find the latest version on the site.
    Also, dont know if its a bug or not, but after i login twice with the autologin, then exit the application and try to login agian, RDM doesnt work due to a memory issue.


  44. admin says:

    Hello Alex

    the latest code download is at

    I have never seen a memory issue with RDP autologin or RDM.



  45. Alex says:

    Hi Joseph,

    It seems that there is still an issue with terminating the RDM process.
    I go to launch the RDP_autologin.exe file and the first time everything works fine, i can disconnect and connect as many times as i like.
    If i close the application it still stays in task manager, and the next time i open it there is no connection made and i get a memory issue.

    I will try to debug it and see why it fails to close the process.


  46. eye1 says:

    Is there a way to set Colors to “High Color (16 bit)” and Remote desktop sound to “Play on this device” ??

  47. admin says:

    Hi eye1

    Yes, this is just an extension to add as variable for creating the .rdp file.



  48. admin says:

    This (color) was already implemented in version 4.

    The option to control sound redirection was added with version 5:…p-autologin-v5

Leave a Reply