<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Windows CE Programming &#187; terminal service client</title>
	<atom:link href="http://www.hjgode.de/wp/tag/terminal-service-client/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hjgode.de/wp</link>
	<description>Windows Mobile Development and usage</description>
	<lastBuildDate>Fri, 03 Feb 2012 08:53:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<!--CodeProjectFeeder channel--><category>CodeProject</category><generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mobile Development: a native remote desktop client (rdesktop port win32)</title>
		<link>http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-a-native-remote-desktop-client-rdesktop-port-win32</link>
		<comments>http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 06:51:47 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[mstsc]]></category>
		<category><![CDATA[rdesktop]]></category>
		<category><![CDATA[rdesktop-ce]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[rdp_autologin]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[terminal service client]]></category>
		<category><![CDATA[tsc]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[wpctsc.exe]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=899</guid>
		<description><![CDATA[A native rdesktop port for windows ce and windows mobile to replace Remote Desktop Mobile]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;"><strong>The famous <a href="http://sourceforge.net/projects/rdesktop/" target="_blank">rdesktop</a> running natively on windows ce and windows mobile</strong></span></p>
<h2>Intro and Background</h2>
<p>Some times ago I found that <a href="http://osdir.com/ml/network.rdesktop.user/2006-04/msg00004.html">message of Jay Sorg</a> and retrieved a copy of his code for a native <a href="http://sourceforge.net/projects/rdesktop/" target="_blank">rdesktop</a> win32 version.  I played a little and got the code compile with Visual Studio 2005 with the Windows Mobile SDK.</p>
<p>I tried to implement windows clipboard support to enhance the transfer of texts between the client and server, but unfortunately I was not successful yet. Hopefully someone jumps in and helps enhancing the code and adds some features.</p>
<p>Rdesktop is open source and you can go with the wince implementation here, but if it does not work for you, you have either change the code yourself (and publish it) or find someone that is able to do for you.</p>
<p>There is a template uiports/xxxwin.c in the actual rdesktop source you can use as a starter to compile the actual rdesktop version for windows mobile if you manage to get all the dependencies to work. If you success, forget this post and go with this version (maybe you leave me a note?).</p>
<p><a rel="attachment wp-att-900" href="http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/screenshot01/"><img class="alignnone size-medium wp-image-900" title="ScreenShot01" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/ScreenShot01-225x300.gif" alt="" width="225" height="300" /></a></p>
<h2>Why another Remote Desktop/Terminal Server Client?</h2>
<p><span id="more-899"></span>The Windows Mobile Remote Desktop Client (or Remote Desktop Mobile, RDM) lacks some useful features available in the Windows CE version or the Desktop Windows version:</p>
<ul>
<li>No automated login</li>
<li>No kiosk mode</li>
<li>Function keys are not sent to server</li>
<li>&#8230;</li>
</ul>
<p>The first item is essential if you like to start a Terminal Server session without user intervention.</p>
<p>The second item is important for using RDM in a production environment.</p>
<p>The third item is useful to run applications on the Terminal Server (TS) that use Function keys.</p>
<h2>Commercial RDM</h2>
<p>There are some commercial remote desktop clients available for windows mobile:</p>
<ul>
<li><a href="http://www.mochasoft.dk/rd.htm">Mochasoft RDP client</a><br />
 &#8220;Windows 200x servers and terminal servers are not supported, as to a Microsoft patent license.&#8221;</li>
<li><a href="http://www.zatelnet.com/zadesktop/main.php">zaDesktop</a><br />
 This is currently in an early state.</li>
<li><a href="http://forum.xda-developers.com/showthread.php?t=292895">RDP Finster</a><br />
 Not really clear where this comes from. </li>
</ul>
<p>I assume some of the commercials are either using mstscax or rdesktop code. Some time ago MS published the <a href="http://msdn.microsoft.com/en-us/library/cc240445%28PROT.10%29.aspx">RDP documentation</a>. Maybe the commercial apps did start from there. Going with the TSC COM library mststcax would be great, but who has the doc for this? For desktop PCs it is documented but not for windows mobile. If someone has a doc to this leave me a note. Then we can start to write a TSC around this library.</p>
<p>There are also some rewritten TSC for the desktop not using mstscax. One is called ProperJavaRDP and maybe a good starting point to rewrite a dotnet based native TSC for windows mobile.</p>
<h2>Usage of the free opensource rdesktop-ce</h2>
<p>You can start winrdesktop on windows mobile either with an ini file or with command line arguments:</p>
<h3>Sample winrdesktop.ini</h3>
<p>(place either in program dir or in root)</p>
<pre>[main]
server=<em>192.168.128.5</em>
port=<em>3389</em>
username=<em>YourUserName</em>
password=<em>YourPassword</em>
bpp=<em>16</em>
geometry=<em>1024x768</em>
#fullscreen
</pre>
<p>server : provide the server IP or DNS host name<br />
 port : provide the port to use for RDP, usually 3389<br />
 username : provide the login user name for the terminal client session<br />
 password : provide the password of the user<br />
 bpp : define the bits per pixel to be used (number of colors per pixel)<br />
 geometry : define the size of the remote desktop window width x height An application to be used on windows mobile devices should match the screen size of the device. For example 240&#215;320 (QVGA). Otherwise the user has to scroll the window to get access to all of the remote screen.<br />
 fullscreen : <span style="text-decoration: line-through;">currently not supported</span></p>
<hr />
<h3>UPDATE 23. nov 2010:</h3>
<p>fullscreen now supported. Fullscreen will switch rdesktop to not show a caption and no menu bar. If geometry matches the device&#8217;s screen size, there will also be no scrollbars.</p>
<p><a rel="attachment wp-att-914" href="http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/screenshotfullscreen/"><img class="alignnone size-medium wp-image-914" title="ScreenShotFullscreen" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/ScreenShotFullscreen-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>This screenshot was taken of an app I wrote running on a Windows 2003 server of a QVGA device with following winrdesktop.ini:</p>
<pre>[main]
server=192.168.128.5
port=3389
username=rdesktop
password=rdesktop
bpp=16
geometry=240x320
fullscreen
</pre>
<hr />
<h2>Rdesktop usage</h2>
<h3>Command line</h3>
<pre>WinRDesktop [-g widthxheight] [-t port] [-a bpp]
    [-f] [-u username] [-p password] [-d domain]
    [-s shell] [-c working directory] [-n host name]
    server-name-or-ip
</pre>
<p>options are the same as in winrdesktop.ini plus:</p>
<pre>-d <em>domain</em> : specify the domain of the user login
-s <em>shell</em> : define a shell to use on TSC
-c <em>working directory</em> : define a working directory for the session
-n <em>host name</em> : specify the host name to use for the client (visible on TSC)
</pre>
<h2>Restrictions of current code</h2>
<p>See <a href="http://code.google.com/p/rdesktop-ce/issues/list?thanks=2&amp;ts=1290249303" target="_blank">googlecode issues</a> for a list of known restrictions.</p>
<h2>Downloads</h2>
<p><a href="http://code.google.com/p/rdesktop-ce/downloads/list">Windows Mobile Executable and INI sample file at googlecode</a><br />
 Source code: see <a href="http://code.google.com/p/rdesktop-ce/source/checkout">googlecode</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F&amp;title=Mobile+Development%3A+a+native+remote+desktop+client+%28rdesktop+port+win32%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F&amp;title=Mobile+Development%3A+a+native+remote+desktop+client+%28rdesktop+port+win32%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F&amp;title=Mobile+Development%3A+a+native+remote+desktop+client+%28rdesktop+port+win32%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F&amp;T=Mobile+Development%3A+a+native+remote+desktop+client+%28rdesktop+port+win32%29" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F20%2Fmobile-development-a-native-remote-desktop-client-rdesktop-port-win32%2F&amp;t=Mobile+Development%3A+a+native+remote+desktop+client+%28rdesktop+port+win32%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Automated Login for Remote Desktop Mobile II</title>
		<link>http://www.hjgode.de/wp/2010/06/23/automated-login-for-remote-desktop-mobile-ii/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automated-login-for-remote-desktop-mobile-ii</link>
		<comments>http://www.hjgode.de/wp/2010/06/23/automated-login-for-remote-desktop-mobile-ii/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 08:00:12 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[mstsc]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[rdp_autologin]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[terminal service client]]></category>
		<category><![CDATA[tsc]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[wpctsc.exe]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=534</guid>
		<description><![CDATA[Tool to have Remote Desktop Mobile login automatically to a terminal server]]></description>
			<content:encoded><![CDATA[<p><strong>Update 18. nov 2011</strong>: fixed some bugs, as mentioned by Patrick S. (great to see, that some take and use the code):</p>
<ul>
<li>screen_width and height for WriteRDP()</li>
<li>read FitToScreen from reg in readReg()</li>
<li>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.</li>
</ul>
<p><strong>Update 16. may 2011:</strong> converted code for VS2008(windows mobile 6 sdk), see Downloads at bottom</p>
<p><strong>UPDATE 23 june 2010</strong>: new registry option to switch between MouseClick and Keyboard simulation:</p>
<pre>REGEDIT4
[HKEY_LOCAL_MACHINE\Software\RDP_autologin]
"FitToScreen"="1"
"FullScreen"="1"
"Status"="connecting..."
"Save Password"="1"
"Domain"=""
"Password"="Intermec+2004"
"Username"="rdesktop"
"Computer"="192.168.0.130"
"DesktopWidth"=640
"DesktopHeight"=480
"startOnExit"="\rdp_keepBusy.exe"
"execargs"="noRDPstart"
"<strong>UseMouseClick"="0"</strong>    //added with version 3 to switch between mouse and keyboard simulation</pre>
<p>&nbsp;</p>
<p>Some days ago I published my RDP_Autologin code: <a href="http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/">RDP_Autologin</a></p>
<p>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.</p>
<p><span id="more-534"></span></p>
<p>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.</p>
<pre>...
	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&gt;0)
		iScreenWidth=iScreenX;
	if(iScreenY&gt;0)
		iScreenHeight=iScreenY;
	if(iScreenX+iScreenY &gt; 0){
		_itow(iScreenWidth, sScreenWidth, 10);
		_itow(iScreenHeight, sScreenHeight, 10);
		return TRUE;
	}
	else
		return FALSE;
}
...</pre>
<p>The rdp file defaults for desktop width and height will also be calculated but you can set the default to use via the registry.</p>
<pre>REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\RDP_autologin]
<strong>"startOnExit"="\Windows\rdp_keepbusy.exe" "DesktopHeight"=dword:000001E0 "DesktopWidth"=dword:00000280</strong>
"Computer"="192.168.0.2"
"FitToScreen"="0"
"FullScreen"="0"
"Username"="rdesktop"
"Password"="xxxx"
"Domain"=""
"Save Password"="1"
"Status"="connecting..."</pre>
<p>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.</p>
<p>Downloads:</p>
<p>evc4 source code: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=94" title="Downloaded 379 times">rdp autologin 2 evc4 source code</a> -  (Hits: 379, size: 113.37 KB)</p>
<p>Armv4i executable: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=95" title="Downloaded 404 times">rdp autologin 2 Armv4i executable</a> -  (Hits: 404, size: 6.47 KB)</p>
<p>NEW: Version 3 adds new option to let the app use MouseClick or Keyboard Simulation</p>
<p><strong>Update 18. nov 2011:</strong> <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=146" title="Downloaded 47 times">Updated rdp_auologin (screen_width/height)</a> -  (Hits: 47, size: 159.78 kB)</p>
<p>Exe File (ArmV4i) <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=105" title="Downloaded 339 times">RDP Autologin Version 3</a> - New version with Mouse or Keyboard simulation switch in registry:
UseMouseClick=DWORD 0/1 (Hits: 339, size: 6.56 kB)</p>
<p>eVC4 source code <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=106" title="Downloaded 200 times">RDP AutoLogin version 3 source code</a> - eVC4 source code for my RDP_AutoLogin version 3 (Hits: 200, size: 131.73 kB)</p>
<p>NEW: VS2008 code and exe <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=138" title="Downloaded 136 times">RDPautologin Visual Studio 2008 code (and Release\\exe)</a> -  (Hits: 136, size: 144.01 kB)</p>
<p>Update 4.march 2011: Please also see http://blogs.msdn.com/b/raffael/archive/2009/09/11/remote-desktop-mobile-rdp-client-disconnects-after-10-minutes-of-inactivity.aspx about idle timeout</p>
<p>&nbsp;</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile+II" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile+II" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile+II" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F&amp;T=Automated+Login+for+Remote+Desktop+Mobile+II" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F23%2Fautomated-login-for-remote-desktop-mobile-ii%2F&amp;t=Automated+Login+for+Remote+Desktop+Mobile+II" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/06/23/automated-login-for-remote-desktop-mobile-ii/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>Automated Login for Remote Desktop Mobile</title>
		<link>http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automated-login-for-remote-desktop-mobile</link>
		<comments>http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:44:37 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[keybd_event]]></category>
		<category><![CDATA[mouse_event]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[SetWindowText]]></category>
		<category><![CDATA[terminal service client]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=273</guid>
		<description><![CDATA[Automate windows and dialogs and mouse clicks on Windows Mobile]]></description>
			<content:encoded><![CDATA[<h2>Remote Desktop Mobile autologin</h2>
<p>As you may know, Remote Desktop Mobile (RDM) does not support auto-login. But sometimes you may want a user does not change settings and is directly connected to a Terminal Server. Ruggedized devices are often used in warehouses and the IT structure uses a terminal server to gather data and manage goods. Although I think Windows Mobile is not the right OS for such barcode scanner devices, you may have no choose and have to use a handheld computer with Windows Mobile instead one that uses Windows CE. The RDM or Terminal Service Client provided with Windows CE devices is much more flexible and can be configured by the OEM to enable you to auto-login into a Terminla Server (TS).</p>
<p>OK, the challenge was to automate the startup and login of RDM on a Windows Mobile 6.1 device. I started using embedded Visual C++ 4.0 although this is outdated by VS2005 and VS2008.</p>
<p>The idea was to launch the exe, fill in the values and click the Connect bar.<span id="more-273"></span></p>
<h3>Finding the connect dialog window</h3>
<p>Normally, on desktop windows, windows and there childs are located in there own tree (see desktop PC spy++ screenshot). On WM61 I found, that the RDM window (class=&#8221;TSSHELLWND&#8221;) and the Connect dialog (class=&#8221;Dialog&#8221;) are located side by side below the desktop window (see cespy screenshot). This makes it hard to find the right dialog, especially as the Connect Dialog does not have a unique window title (window text). The windows can be identified as belonging together by there processID.</p>
<p><a rel="attachment wp-att-275" href="http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/spy-trees/"><img class="alignnone size-medium wp-image-275" title="spy-trees" src="http://www.hjgode.de/wp/wp-content/uploads/2010/01/spy-trees-300x265.gif" alt="" width="300" height="265" /></a></p>
<div id="attachment_274" class="wp-caption alignleft" style="width: 250px"><br />
<a rel="attachment wp-att-274" href="http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/connect_dialog/"><img class="alignnone size-full wp-image-274" title="connect_dialog" src="http://www.hjgode.de/wp/wp-content/uploads/2010/01/connect_dialog.gif" alt="" width="240" height="317" /></a><p class="wp-caption-text">RDM Connect Dialog</p></div>
<h3>Filling the fields</h3>
<p>Knowing the right window I was able to set the text entries by knowing there controlIDs (dialogs use ctrlIDs for easier access of the data, see scanTscDialog() in tscDialog.cpp). So the tool I did can fill in all connection details using SetWindowText().</p>
<h3>Execute the Connect</h3>
<p>The fields are filled with the connection details and now I needed a way to simulate a click onto the connect button (which is a menu in reality) to let the dialog execute a connect. I tried several approaches, the best is to use keyb_event although it works also by sending the TSC window the WM_USER message that is posted by the menu click. I found this WM_USER message within messages of cespy as I tapped on [Connect].</p>
<pre lang="cplusplus"> //Solution three, best solution, ensure you use the scancode value too! AFAIK the scancode for F1 is always 0x70
keybd_event(VK_F1, 0x70, 0, 0);
 Sleep(30);
 keybd_event(VK_F1, 0x70, KEYEVENTF_KEYUP, 0);</pre>
<p>I was unable to send TSSHELLWND nor the Dialog a click onto the menu option [Connect]. The menu seems to be not owned by either of these two visible windows. The menu bar looks like owned by the desktop window.</p>
<p>Sending the SoftKey1 (F1) was also unsuccessfull for window handles of TSSHELLWND and the Connect Dialog.</p>
<h3>The pitfalls</h3>
<p>Everything seems to work OK, but sometimes the tool was unable to fill the fields and execute the connect. I did search several hours and then I found, that the registry and a file is involved in the connect.</p>
<p>The tool always failed to autoconnect after the first clean boot. So I did a snapshot with the famous free SSNAP by &#8220;S-K tools&#8221; and found the changes that caused a manualy connect to be successfull.</p>
<h4>Registry changes</h4>
<p>First, the registry will get be changed, if you manually connect. As I did not like to have my tool to emulate a user typing into the fields using keybd_event, I added code, that does the same changes to the registry (see writeMRU() function in code). There are some more changes in registry, but fortunately I did not have to implement these too (see comments in &#8220;tscDialog.cpp&#8221;).</p>
<h4>RDP file default.rdp</h4>
<p>When you fill the connect dialog and then press [Connect] RDM will save your values in a file \Windows\default.rdp. You may know, that rdp files are commonly used on desktop windows to save/load Remote Desktop Session connection data. Yes, WM6.1 does use a similar technique.</p>
<p>The tool had to provide a default.rdp with the data of the connection settings. So I wrote a function to create and write this file from scratch on every start (see writeRDP() in tsc_dialog.cpp and rdp_file.h). As options, like &#8220;FullScreen&#8221; or &#8220;Fit to Screen&#8221; are also controlled by the rdp file, I was able to control these settings by code.</p>
<h3>Conclusion</h3>
<p>So far the tool works. Dont download if you dont like spaghetti. The code is written as grown.</p>
<h3>Usage</h3>
<p>Write the correct values for the connection to the registry</p>
<pre>[HKEY_LOCAL_MACHINE\Software\RDP_autologin]
"FitToScreen"="1"
"FullScreen"="1"
"Status"="connecting..."
"Save Password"="1"
"Domain"=""
"Password"="xxxxxxxxxx"
"Username"="rdesktop"
"Computer"="192.168.0.130"</pre>
<p>Then simply start the tool. First it will terminate a running instance of RDM. Then it starts a new instance and starts to fill the fields and do the connect.</p>
<h4>Warranty</h4>
<p>No warranty, code is provided as is. Hopefully it is usefull for the one or other.</p>
<h4>Changes</h4>
<p>Some values are hard coded, ie the control IDs used. These IDs may be different on other devices or within other RDM releases. So far the code works on my testing device. If you need to change the control IDs you may use the scanTscDialog() function to get the actual codes listed in the debug window.</p>
<p>Have fun!</p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=48" title="Downloaded 1251 times">RDP_autologin CPP source EVC4</a> -  (Hits: 1251, size: 123.58 KB)
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=49" title="Downloaded 1198 times">RDP_autologin ARMv4i exe and reg file</a> -  (Hits: 1198, size: 4.27 KB)
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F&amp;title=Automated+Login+for+Remote+Desktop+Mobile" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F&amp;T=Automated+Login+for+Remote+Desktop+Mobile" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F01%2F21%2Fautomated-login-for-remote-desktop-mobile%2F&amp;t=Automated+Login+for+Remote+Desktop+Mobile" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/01/21/automated-login-for-remote-desktop-mobile/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

