<?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</title>
	<atom:link href="http://www.hjgode.de/wp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hjgode.de/wp</link>
	<description>Windows Mobile Development and usage</description>
	<lastBuildDate>Thu, 10 May 2012 20:36:47 +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.2</generator>
		<item>
		<title>Windows Mobile: Kiosk Mode Series, part 1</title>
		<link>http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-mobile-kiosk-mode-series-part-1</link>
		<comments>http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/#comments</comments>
		<pubDate>Thu, 10 May 2012 20:17:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[Done Button]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[hide start]]></category>
		<category><![CDATA[Start Button]]></category>
		<category><![CDATA[Windows embedded handheld 6.5.3]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1386</guid>
		<description><![CDATA[Hello I would like to start a series of articles of how you can lockdown your application user in your application. How can you achieve a kiosk mode application, where the user is only allowed to do what you define. The first article is about the Windows Start and Done Icon in menu bar and about [...]]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>I would like to start a series of articles of how you can lockdown your application user in your application. How can you achieve a kiosk mode application, where the user is only allowed to do what you define.</p>
<p>The first article is about the Windows Start and Done Icon in menu bar and about fullscreen. You may already know, how to hide the start and done icon permanently from a Windows Embedded Handheld (Windows Mobile 6.5.3) device: <a href="http://www.hjgode.de/wp/2010/10/11/windows-mobile-hide-startbutton-in-winmo-6-5-x/">Link</a></p>
<p>But there is also a temporary way using the same approach. The trick is to change the registry keys, that make the OS believe you have hardware buttons for Start and Done, BEFORE you show your CSharp form.</p>
<p>Before Windows Embedded Handheld (WEH, or Windows Mobile 6.5.3), you are able to use SHFullScreen API calls. But this will not work with WEH. Neither the flags SHFS_HIDESIPBUTTON nor SHFS_HIDESTARTICON will work. The LockDown.cs class also includes code for that and you may test the functions with the Test-Application.</p>
<p><a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/shfullscreen-menu/" rel="attachment wp-att-1405"><img class="alignnone size-medium wp-image-1405" title="shfullscreen-menu" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/shfullscreen-menu-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>The class I am talking about is called LockDown. There is also a Test-Application (OEMTitleBarHandler, dont ask me about the name selection) to test all functions I will describe.</p>
<p><a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-without-starticon-menu/" rel="attachment wp-att-1389"><span id="more-1386"></span><img class="alignnone size-medium wp-image-1389" title="form-without-starticon-menu" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-without-starticon-menu-225x300.gif" alt="" width="225" height="300" /></a> <a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-without-starticon-menu_wm653/" rel="attachment wp-att-1392"><img class="alignnone size-medium wp-image-1392" title="form-without-starticon-menu_wm653" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-without-starticon-menu_wm653-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>Left is Windows Mobile 6.1 and right image shows Windows Embedded Handheld 6.5.3! You can use the ShFullScreen menu on both, but it will only work with Mobile 6.1. But the test &#8220;Form without StartIcon&#8221; will bring up a form without Start button.</p>
<p><a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-without-starticon_wm653/" rel="attachment wp-att-1395"><img class="alignnone size-medium wp-image-1395" title="form-without-starticon_wm653" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-without-starticon_wm653-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>OK, let&#8217;s look what we can do to hide the Start icon for a new form:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">private</span> <span class="kw1">void</span> mnuStartIconTestForm_Click<span class="br0">&#40;</span><span class="kw4">object</span> sender, EventArgs e<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            Lockdown.<span class="me1">LockDown</span>.<span class="me1">SaveRegistryFullScreen</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            Lockdown.<span class="me1">LockDown</span>.<span class="me1">SetRegistryFullScreen</span><span class="br0">&#40;</span><span class="kw1">true</span>, <span class="kw1">false</span>, <span class="kw1">false</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            LockDownTestForm frm <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> LockDownTestForm<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            frm.<span class="me1">ShowDialog</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            Lockdown.<span class="me1">LockDown</span>.<span class="me1">RestoreRegistryFullScreen</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            frm.<span class="me1">Dispose</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>The function SaveRegistryFullScreen() save the state of the registry values of TextmodeEnabled, HardwareStartKeyEnabled and HardwareDoneKeyEnabled below &#8220;HKLM\SOFTWARE\Microsoft\Shell\BubbleTiles&#8221;.</p>
<p>The function SetRegistryFullScreen(bool bStartButtonPresent, bool bDoneButtonPresent, bool bTextMode) sets the registry key according to the args. So, if  bStartButtonPresent is set to true, the registry value of HardwareStartKeyEnabled  is set to 1. With this setting, the next form or window is shown without Start button. Easy, isn&#8217;t it. The other args work similar.</p>
<p>RestoreRegistryFullScreen will restore the registry to the state saved with SaveRegistryFullScreen().</p>
<p>How can you remove all buttons that enable the user to quit or minimize a form? To show a compact framework form with or without Done or Minimize buttons, you just have to set the right properties of the form. But dont forget to give the user an option to get back from a form.</p>
<p>The ControlBox property switches the (X)/ (OK) button display. The clicking an (OK) button will close and exit a form or application:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">private</span> <span class="kw1">void</span> mnuControlBox_Click<span class="br0">&#40;</span><span class="kw4">object</span> sender, EventArgs e<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw1">this</span>.<span class="me1">ControlBox</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="co1">//show the (X) button, hide OK button</span></div></li><li class="li1"><div class="de1">                <span class="kw1">this</span>.<span class="me1">ControlBox</span> <span class="sy0">=</span> false<span class="sy0">;</span></div></li><li class="li1"><div class="de1">                mnuControlBox.<a href="http://www.google.com/search?q=checked+msdn.microsoft.com"><span class="kw3">Checked</span></a> <span class="sy0">=</span> false<span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">else</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="co1">//remove the (X) button in title, show the OK button</span></div></li><li class="li1"><div class="de1">                <span class="kw1">this</span>.<span class="me1">ControlBox</span> <span class="sy0">=</span> true<span class="sy0">;</span></div></li><li class="li1"><div class="de1">                mnuControlBox.<a href="http://www.google.com/search?q=checked+msdn.microsoft.com"><span class="kw3">Checked</span></a> <span class="sy0">=</span> true<span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>The MinimizeBox property of a compact framework form switches the (OK) button to a (X) button. Where (X) stands for minimize window.</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">private</span> <span class="kw1">void</span> mnuMinimizeBox_Click<span class="br0">&#40;</span><span class="kw4">object</span> sender, EventArgs e<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw1">this</span>.<span class="me1">MinimizeBox</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="co1">//hide minimize button (OK)</span></div></li><li class="li1"><div class="de1">                <span class="kw1">this</span>.<span class="me1">MinimizeBox</span> <span class="sy0">=</span> false<span class="sy0">;</span></div></li><li class="li1"><div class="de1">                mnuMinimizeBox.<a href="http://www.google.com/search?q=checked+msdn.microsoft.com"><span class="kw3">Checked</span></a> <span class="sy0">=</span> false<span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">else</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="co1">//show minimize button (OK)</span></div></li><li class="li1"><div class="de1">                <span class="kw1">this</span>.<span class="me1">MinimizeBox</span> <span class="sy0">=</span> true<span class="sy0">;</span></div></li><li class="li1"><div class="de1">                mnuMinimizeBox.<a href="http://www.google.com/search?q=checked+msdn.microsoft.com"><span class="kw3">Checked</span></a> <span class="sy0">=</span> true<span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>The Test application has also menu options to test these properties as &#8220;Window Options&#8221;.</p>
<p><a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-controlbox-menu/" rel="attachment wp-att-1400"><img class="alignnone size-medium wp-image-1400" title="form-controlbox-menu" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-controlbox-menu-225x300.gif" alt="" width="225" height="300" /></a> <a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-controlbox-off/" rel="attachment wp-att-1401"><img class="alignnone size-medium wp-image-1401" title="form-controlbox-off" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-controlbox-off-225x300.gif" alt="" width="225" height="300" /></a> <a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/form-controlboxon-minimizeoff/" rel="attachment wp-att-1402"><img class="alignnone size-medium wp-image-1402" title="form-controlboxOn-minimizeOff" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/form-controlboxOn-minimizeOff-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>The menu option Maximize shows the testform maximized (oh, wonder), but that means only, that the taskbar at the top is hidden and the client area is larger. If you additionally set the menu to null, you will get a real full screen form:</p>
<p><a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/window-maximized/" rel="attachment wp-att-1406"><img class="alignnone size-medium wp-image-1406" title="window-maximized" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/window-maximized-225x300.gif" alt="" width="225" height="300" /></a> <a href="http://www.hjgode.de/wp/2012/05/10/windows-mobile-kiosk-mode-series-part-1/window-maximized-nomenu/" rel="attachment wp-att-1407"><img class="alignnone size-medium wp-image-1407" title="window-maximized-nomenu" src="http://www.hjgode.de/wp/wp-content/uploads/2012/05/window-maximized-nomenu-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>You have to press the Escape key (hopefully you have one) to bring the menu back in the test application.</p>
<p>The class file LockDown offers some more functions, but these are left for another article.</p>
<p>The whole code with the test application is available <a title="code.google.com" href="http://code.google.com/p/weh653kiosmodes/source/checkout" target="_blank">here</a>. You need a subversion client like TortoiseSVN or AnkhSVN to checkout the source code.</p>
<p>Download LockDown.cs: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=161" title="Downloaded 3 times">LockDown.cs</a> -  (Hits: 3, size: 2.19 kB)</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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%2F&amp;title=Windows+Mobile%3A+Kiosk+Mode+Series%2C+part+1" 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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%2F&amp;title=Windows+Mobile%3A+Kiosk+Mode+Series%2C+part+1" 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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%2F&amp;title=Windows+Mobile%3A+Kiosk+Mode+Series%2C+part+1" 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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%2F&amp;T=Windows+Mobile%3A+Kiosk+Mode+Series%2C+part+1" 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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%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%2F2012%2F05%2F10%2Fwindows-mobile-kiosk-mode-series-part-1%2F&amp;t=Windows+Mobile%3A+Kiosk+Mode+Series%2C+part+1" 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/2012/05/10/windows-mobile-kiosk-mode-series-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting rid of obsolete Microsoft Windows Mobile Remote Adapter s</title>
		<link>http://www.hjgode.de/wp/2012/04/21/getting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s</link>
		<comments>http://www.hjgode.de/wp/2012/04/21/getting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 17:13:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ActiveSync]]></category>
		<category><![CDATA[DevCon.exe]]></category>
		<category><![CDATA[Microsoft Windows Mobile Remote Adapter]]></category>
		<category><![CDATA[obsolete]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[WMDC]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1360</guid>
		<description><![CDATA[As a windows mobile programmer I have to fight with ActiveSync aka Windows Mobile Device Center. The newer WM devices come with enhanced network function via USB ActiveSync/WMDC and then each time a new device is connected, you will get a new Mobile Remote Adapter with a new number at the end. First, I dont [...]]]></description>
			<content:encoded><![CDATA[<p>As a windows mobile programmer I have to fight with ActiveSync aka Windows Mobile Device Center. The newer WM devices come with enhanced network function via USB ActiveSync/WMDC and then each time a new device is connected, you will get a new Mobile Remote Adapter with a new number at the end.</p>
<p><a href="http://www.hjgode.de/wp/2012/04/21/getting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s/enable-advanced-network-functionality/" rel="attachment wp-att-1364"><img class="alignnone size-medium wp-image-1364" title="Enable advanced network functionality" src="http://www.hjgode.de/wp/wp-content/uploads/2012/04/Enable-advanced-network-functionality-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>First, I dont need any partnership and so I change my system to do <a href="http://www.hjgode.de/wp/tag/partnership/">GuestOnly</a> connections with WMDC (Windows Mobile 7, 64Bit system).</p>
<p>OK, second annoyance is the awlays coming up WMDC or WMDC+Mobile Registration Wizard. These Popups can be avoided by changing the call to WMDC.exe to WMDCbase.exe. See also this <a href="http://www.hjgode.de/wp/2012/03/28/mobile-development-autohide-windows-mobile-device-center-2/">post</a>.</p>
<p>So, I can connect one of the several devices I have currently for development support (about 10-30) without annoying popups.</p>
<p>But then I found, that for each device and sometimes multiple times, Windows installs a new &#8220;Microsoft Windows Mobile Remote Adapter&#8221; in Device Manager. I found about 88 instances, where only ONE is needed. Before you can see the inactive adapters, you have to enable Show_Hidden_Devices. One way to show hidden devices is <a href="http://support.microsoft.com/kb/315539">this</a> []:</p>
<ol>
<li>Click <strong>Start</strong>, point to <strong>All Programs</strong>, point to <strong>Accessories</strong>, and then click <strong>Command Prompt</strong>.</li>
<li>At a command prompt, type the following command , and then press ENTER:
<div>set devmgr_show_nonpresent_devices=1</div>
</li>
<li>Type the following command a command prompt, and then press ENTER:
<div>start devmgmt.msc</div>
</li>
<li>Troubleshoot the devices and drivers in Device Manager.
<p><strong>NOTE</strong>: Click <strong>Show hidden devices</strong> on the <strong>View</strong> menu in Device Manager before you can see devices that are not connected to the computer.</li>
<li>When you finish troubleshooting, close Device Manager.</li>
<li>Type exit at the command prompt.</li>
</ol>
<p>To remove the hidden, inactive Mobile Remote Instances, you can now right click on every instance, then click UnInstall and then [OK]. But for 88 instances, that is a bunch of clicking.</p>
<p>As programmer, I searched of a way to remove these instances programmatically. OK, I digged google and found DevCon, a tool to manage devices and instances from the command line. Unfortunately, I had to download a CD image of Windows WDK to get DevCon.exe. Then I found a site which described <a href="http://social.technet.microsoft.com/wiki/contents/articles/182.aspx">howto install DevCon only</a>.</p>
<p>With the help of DevCon.exe, I produced a list of &#8220;Microsoft Windows Mobile Remote Adapter&#8221; instances, removed to not numbered one and then built a list of DevCon commands to remove the obsolete instances.</p>
<p>List all Windows Mobile Remote Adapters into a file:</p>
<pre>devcon findall "USB\VID_067E&amp;PID_1003&amp;REV_0000" &gt;wm_remote_adapters.txt</pre>
<p>&#8220;USB\VID_067E&amp;PID_1003&amp;REV_0000&#8243; is the identifier for Windows Mobile Remote Adapter (you can find this by right clicking the instance in device manager and select properties).</p>
<pre>USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-0DE0-01130400682B  : Microsoft Windows Mobile Remote Adapter #59
USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-1B10-010E04000801  : Microsoft Windows Mobile Remote Adapter #6
USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-0B70-000E0400BA61  : Microsoft Windows Mobile Remote Adapter #24
USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-1990-001104000E40  : Microsoft Windows Mobile Remote Adapter #77
USB\VID_067E&amp;PID_1003\99461300-B56A-0801-DD17-0FBB99944738  : Microsoft Windows Mobile Remote Adapter #89
...</pre>
<p>Then, in the list wm_remote_adapters.txt, I replaced all line starts etc and built this cmd list:</p>
<pre>devcon.exe remove "@USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-0590-010E0400A43B"
devcon.exe remove "@USB\VID_067E&amp;PID_1003\99461300-B56A-0801-5AD3-B56444802FC3"
devcon.exe remove "@USB\VID_067E&amp;PID_1003\99461300-B56A-0801-B87A-D1874E00C078"
devcon.exe remove "@USB\VID_067E&amp;PID_1003\0040056A-0E9D-0801-1640-01100400B075"
...</pre>
<p>Then I saved this cmd list as remove-adapters.cmd and started it from the command prompt. And, voila, all obsolete adapters are gone for now.</p>
<p>From time to time I have to rebuild the lists again to get rid of these many obsolete adapters.</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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%2F&amp;title=Getting+rid+of+obsolete+Microsoft+Windows+Mobile+Remote+Adapter+s" 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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%2F&amp;title=Getting+rid+of+obsolete+Microsoft+Windows+Mobile+Remote+Adapter+s" 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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%2F&amp;title=Getting+rid+of+obsolete+Microsoft+Windows+Mobile+Remote+Adapter+s" 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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%2F&amp;T=Getting+rid+of+obsolete+Microsoft+Windows+Mobile+Remote+Adapter+s" 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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%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%2F2012%2F04%2F21%2Fgetting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s%2F&amp;t=Getting+rid+of+obsolete+Microsoft+Windows+Mobile+Remote+Adapter+s" 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/2012/04/21/getting-rid-of-obsolete-microsoft-windows-mobile-remote-adapter-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development: AutoHide Windows Mobile Device Center 2</title>
		<link>http://www.hjgode.de/wp/2012/03/28/mobile-development-autohide-windows-mobile-device-center-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-autohide-windows-mobile-device-center-2</link>
		<comments>http://www.hjgode.de/wp/2012/03/28/mobile-development-autohide-windows-mobile-device-center-2/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 13:50:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[ActiveSync]]></category>
		<category><![CDATA[autohide]]></category>
		<category><![CDATA[windows Mobile Device Center]]></category>
		<category><![CDATA[WMDC]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1351</guid>
		<description><![CDATA[In an earlier post I wrote about a tool to autohide the annoying WMDC window. As a developer I dont like to keep WMDC come up every time I connect a device. I just need to know, if the device is connected or not. Fortunately, Henkie leaved a comment about a usefull alternative for WMDC. [...]]]></description>
			<content:encoded><![CDATA[<p>In an earlier post I wrote about a tool to autohide the annoying WMDC window. As a developer I dont like to keep WMDC come up every time I connect a device. I just need to know, if the device is connected or not.</p>
<p>Fortunately, Henkie leaved a comment about a usefull alternative for WMDC. But as commented <a href="http://www.hjgode.de/wp/2011/05/13/mobile-development-autohide-windows-mobile-device-center/">here</a>, no visual control of the connection.</p>
<p>Now I started to think about a small tool to have a visual control of WMDC connected or not. I had to use RAPI either provided by MS or via OpenNetCF.Desktop.Communication. Although the OpenNETCF one works OK, I was not satisfied, as it was impossible to get a connection status without disconnect/connect. So I went back to WIN32 API and wrote this small tool based on DeviceInfo sample of Windows Mobile 6 SDK.</p>
<p>First I again messed up with notification icons in Windows 7 (64bit). But the icon may be removed or not, depending on Windows 7 decisions I dont know.</p>
<p>So the tool uses a simple window and an icon to let you know the connection status.</p>
<p><a href="http://www.hjgode.de/wp/2012/03/28/mobile-development-autohide-windows-mobile-device-center-2/wmdc-state2/" rel="attachment wp-att-1352"><img class="alignnone size-full wp-image-1352" title="wmdc-state2" src="http://www.hjgode.de/wp/wp-content/uploads/2012/03/wmdc-state2.gif" alt="" width="610" height="432" /></a></p>
<p>Just start the tool and the icon and edit window background will show, if device is connected or not. The application icon in the title bar as in the taskbar button will change from gray to color for a connected versa a disconnected device.</p>
<p>Visual Studio 2008 C/C++ Win32 code and exe: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=159" title="Downloaded 61 times">WMDC-State2 Code and Exe</a> -  (Hits: 61, size: 122.55 kB)</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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%2F&amp;title=Mobile+Development%3A+AutoHide+Windows+Mobile+Device+Center+2" 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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%2F&amp;title=Mobile+Development%3A+AutoHide+Windows+Mobile+Device+Center+2" 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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%2F&amp;title=Mobile+Development%3A+AutoHide+Windows+Mobile+Device+Center+2" 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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%2F&amp;T=Mobile+Development%3A+AutoHide+Windows+Mobile+Device+Center+2" 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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%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%2F2012%2F03%2F28%2Fmobile-development-autohide-windows-mobile-device-center-2%2F&amp;t=Mobile+Development%3A+AutoHide+Windows+Mobile+Device+Center+2" 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/2012/03/28/mobile-development-autohide-windows-mobile-device-center-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows Embedded Handheld 6.5.3: disable all connection dialogs</title>
		<link>http://www.hjgode.de/wp/2012/03/22/windows-embedded-handheld-6-5-3-disable-all-connection-dialogs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-embedded-handheld-6-5-3-disable-all-connection-dialogs</link>
		<comments>http://www.hjgode.de/wp/2012/03/22/windows-embedded-handheld-6-5-3-disable-all-connection-dialogs/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 10:08:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows Mobile Information]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1348</guid>
		<description><![CDATA[Here a small tip: To disable all Connection Manager Dialogs set the following registry key: [HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable &#8220;All&#8221;=dword:1 to disable only certain dialogs or notification bubbles, use IDs like IDS_RAS_CARRIER_DROPPED: [HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable &#8220;0&#8243;=dword:1 to disable multiple dialogs, simply define additional IDs. For example to disable dialogs for IDS_RAS_DEVICE_NOT_READY and IDS_RAS_NO_ANSWER: [HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable &#8220;3&#8243;=dword:1 &#8220;5&#8243;=dword:1 Have fun List of [...]]]></description>
			<content:encoded><![CDATA[<p>Here a small tip:</p>
<p>To disable all Connection Manager Dialogs set the following registry key:</p>
<p>[HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable<br />
&#8220;All&#8221;=dword:1</p>
<p>to disable only certain dialogs or notification bubbles, use IDs like IDS_RAS_CARRIER_DROPPED:</p>
<p>[HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable<br />
&#8220;0&#8243;=dword:1</p>
<p>to disable multiple dialogs, simply define additional IDs. For example to disable dialogs for IDS_RAS_DEVICE_NOT_READY and IDS_RAS_NO_ANSWER:</p>
<p>[HKLM]Software\Microsoft\Shell\Rai\:MSREMNET\Disable<br />
&#8220;3&#8243;=dword:1<br />
&#8220;5&#8243;=dword:1</p>
<p>Have fun</p>
<p>List of all IDS values: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=160" title="Downloaded 27 times">IDS dialog values</a> -  (Hits: 27, size: 13.02 kB)</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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%2F&amp;title=Windows+Embedded+Handheld+6.5.3%3A+disable+all+connection+dialogs" 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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%2F&amp;title=Windows+Embedded+Handheld+6.5.3%3A+disable+all+connection+dialogs" 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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%2F&amp;title=Windows+Embedded+Handheld+6.5.3%3A+disable+all+connection+dialogs" 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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%2F&amp;T=Windows+Embedded+Handheld+6.5.3%3A+disable+all+connection+dialogs" 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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%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%2F2012%2F03%2F22%2Fwindows-embedded-handheld-6-5-3-disable-all-connection-dialogs%2F&amp;t=Windows+Embedded+Handheld+6.5.3%3A+disable+all+connection+dialogs" 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/2012/03/22/windows-embedded-handheld-6-5-3-disable-all-connection-dialogs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WM 6.5: Remote Desktop Client disconnects after 10 minutes rev 3</title>
		<link>http://www.hjgode.de/wp/2012/03/21/wm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3</link>
		<comments>http://www.hjgode.de/wp/2012/03/21/wm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 08:21:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[disconnects]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[wpctsc.exe]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1345</guid>
		<description><![CDATA[Just a post to let you know, that RDM_KeepBusy for WM6.5 has been updated Bookmark It]]></description>
			<content:encoded><![CDATA[<p>Just a post to let you know, that <a title="RDM_KeepBusy updated" href="http://www.hjgode.de/wp/2011/07/04/wm-6-5-remote-desktop-client-disconnects-after-10-minutes/">RDM_KeepBusy for WM6.5</a> has been updated</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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%2F&amp;title=WM+6.5%3A+Remote+Desktop+Client+disconnects+after+10+minutes+rev+3" 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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%2F&amp;title=WM+6.5%3A+Remote+Desktop+Client+disconnects+after+10+minutes+rev+3" 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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%2F&amp;title=WM+6.5%3A+Remote+Desktop+Client+disconnects+after+10+minutes+rev+3" 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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%2F&amp;T=WM+6.5%3A+Remote+Desktop+Client+disconnects+after+10+minutes+rev+3" 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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%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%2F2012%2F03%2F21%2Fwm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3%2F&amp;t=WM+6.5%3A+Remote+Desktop+Client+disconnects+after+10+minutes+rev+3" 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/2012/03/21/wm-6-5-remote-desktop-client-disconnects-after-10-minutes-rev-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development &#8211; Compact Framework: Managed Extension Framework (MEF)</title>
		<link>http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-compact-framework-managed-extension-framework-mef</link>
		<comments>http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 14:04:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[DLL]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[Hardware abstraction layer]]></category>
		<category><![CDATA[Managed Extensibility Framework]]></category>
		<category><![CDATA[MEF]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1316</guid>
		<description><![CDATA[Hello this post describes a way to load class libraries (DLLs) dynamically on demand in your compact framework application. What is it good for? Hardware abstraction. Load only matching Libraries. Organize your development for different devices. You will be able to only load the right hardware (device) dependent libraries. You are able to use a [...]]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>this post describes a way to load class libraries (DLLs) dynamically on demand in your compact framework application.</p>
<h1>What is it good for?</h1>
<h2>Hardware abstraction. Load only matching Libraries.</h2>
<p>Organize your development for different devices. You will be able to only load the right hardware (device) dependent libraries. You are able to use a hardware abstraction layer.</p>
<p>Normally, you add a reference to an assembly during development in Visual Studio. Now, when the application starts on the device, it will try to load this assembly. If it contains hardware dependent code, like a barcode scanner library, the load of your application may fail.</p>
<p>Using the techniques described here, you can avoid this and direct your app to only load device matching libraries.</p>
<h2>Plugin usage</h2>
<p>You can write a Compact Framework application that will load and work with plugins. These reside in DLLs and can be added or removed on demand.</p>
<p>You can for example write an application launcher that will list the installed extensions. In example for a Transport and Logistic application you can have a truck loading and a truck unloading extension. If you have to update one of the plugins, you only need to replace the plugin DLL, the rest of the application (for example Login forms, Information screens, connection management) remains unchanged.</p>
<h1>DLL loading in C/C++</h1>
<p>Loading libs dynamically is well known in C/C++. You simply use LoadLibrary(dllName) and then you can get the addresses to known library functions and use these.</p>
<p>Static linking: Adding a reference in a compact framework (SmartDevice) application inside Visual Studio is like adding a header and lib file to a C/C++ application.</p>
<h1>DLL loading in Compact Framework</h1>
<p>You can also use the above in C#/VB.NET.</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">namespace</span> ConsoleApplication1</div></li><li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">  <span class="kw4">class</span> Program</div></li><li class="li1"><div class="de1">  <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">static</span> IClass1 GetIClass1<span class="br0">&#40;</span><span class="kw4">string</span> filename<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">      Assembly classLibrary1 <span class="sy0">=</span> null<span class="sy0">;</span></div></li><li class="li1"><div class="de1">      <span class="kw1">using</span> <span class="br0">&#40;</span>FileStream fs <span class="sy0">=</span> File.<span class="me1">Open</span><span class="br0">&#40;</span>filename, FileMode.<span class="me1">Open</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">      <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw1">using</span> <span class="br0">&#40;</span>MemoryStream ms <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> MemoryStream<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">          <span class="kw4">byte</span><span class="br0">&#91;</span><span class="br0">&#93;</span> buffer <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> <span class="kw4">byte</span><span class="br0">&#91;</span>1024<span class="br0">&#93;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">          <span class="kw4">int</span> read <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">          <span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>read <span class="sy0">=</span> fs.<span class="me1">Read</span><span class="br0">&#40;</span>buffer, 0, 1024<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">&gt;</span>0<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            ms.<span class="me1">Write</span><span class="br0">&#40;</span>buffer, 0, read<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">          classLibrary1 <span class="sy0">=</span> Assembly.<span class="me1">Load</span><span class="br0">&#40;</span>ms.<span class="me1">ToArray</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">      <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">      <span class="kw1">foreach</span> <span class="br0">&#40;</span>Type type <span class="kw1">in</span> classLibrary1.<span class="me1">GetExportedTypes</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">      <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw1">if</span> <span class="br0">&#40;</span>type.<span class="me1">GetInterface</span><span class="br0">&#40;</span><span class="st0">&quot;IClass1&quot;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="kw1">null</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">          <span class="kw1">return</span> Activator.<span class="me1">CreateInstance</span><span class="br0">&#40;</span>type<span class="br0">&#41;</span> <span class="kw1">as</span> IClass1<span class="sy0">;</span></div></li><li class="li1"><div class="de1">      <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">      <span class="kw1">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> Exception<span class="br0">&#40;</span><span class="st0">&quot;no class found that implements interface IClass1&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="kw1">static</span> <span class="kw1">void</span> Main<span class="br0">&#40;</span><span class="kw4">string</span><span class="br0">&#91;</span><span class="br0">&#93;</span> args<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">      IClass1 class1 <span class="sy0">=</span> GetIClass1<span class="br0">&#40;</span><span class="st0">&quot;ClassLibrary1.dll&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">      class1.<span class="me1">DoSomething</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">  <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>[source: http://social.msdn.microsoft.com/forums/en-US/clr/thread/093c3606-e68e-46f4-98a1-f2396d3f88ca/], may not work without change in CF.</p>
<p><span id="more-1316"></span>Using writing all the C/C++ LoadLibrary/GetProcAddress or the above for all your library functions  is very time consuming and error-prone.</p>
<p>There is another way using class interfaces and libraries for hardware dependent code described at MSDN: <a href="http://msdn.microsoft.com/en-us/library/aa446489.aspx" target="_blank">Barcode Scanners and the Compact Framework</a>. The disadvantage of this solution is, that you have to add references to all different possible implementation assemblies: in the example, you have to add a ref to the Intermec barcode scanner implementation and to the symbol barcode scanner. Imagine if you have to manage this for 4 and more manufacturer and not only for barcode scanners but also for other OEM vendor features (WLAN, keyboard).</p>
<p>So, looking for a better solution, I found the <strong>Managed Extensibility Framework</strong> (MEF) and fortunately a Pocket MEF (the compact framework compatible variant). MEF was developed as a community project with technology previews at <a href="http://mef.codeplex.com/" target="_blank">codeplex</a>. It now is part of NET 4.0 framework.<br />
Pocket MEF is also hosted a <a href="http://pocketmef.codeplex.com/" target="_blank">codeplex</a>, it follows the main technology previews until CTP8.1. Although the full MEF has already reached version 2, the Pocket MEF is sufficiant to be very usefull.</p>
<h1>Pocket MEF</h1>
<p>I will describe how you can use PocketMEF to write an application that will automatically load the right hardware dependent DLLs. We will use PocketMEF to implement a Hardware Abstraction Layer (HAL). PocketMEF will load the right assemblies during runtime on demand using a file name pattern.</p>
<h2>Use Interfaces</h2>
<p>This step is also used in the article at http://msdn.microsoft.com/en-us/library/aa446489.aspx. Using interfaces or factory classes ensures, that your &#8220;plugins&#8221; or OEM modules have all the same interface.</p>
<p>Hardware abstraction: Implement the different OEM dependent class libs<br />
Let PocketMEF load the right class libs</p>
<p>Plugin use: Implement different plugins using the same interface<br />
Let PocketMEF load all matching plugins</p>
<h1>The sample solution MEFdemo</h1>
<p>I have done a sample application that shows both, hardware abstraction and plugin usage. The Visual Studio 2008 Windows Mobile 6 Prof. solution defines a main application, two different contracts (interfaces) and some extensions that fullfill the interfaces.</p>
<p><a href="http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/solution/" rel="attachment wp-att-1323"><img class="alignnone size-medium wp-image-1323" title="Viual Studio Solution" src="http://www.hjgode.de/wp/wp-content/uploads/2012/02/solution-300x288.jpg" alt="" width="300" height="288" /></a></p>
<p>Unfortunately, the solution is more complex, as it shows both aspects. OK, here is a design schema:</p>
<p><a href="http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/mefdemo-design/" rel="attachment wp-att-1324"><img class="alignnone size-full wp-image-1324" title="mefdemo-design" src="http://www.hjgode.de/wp/wp-content/uploads/2012/02/mefdemo-design.png" alt="" width="734" height="479" /></a></p>
<p>You see, we have one IAppPlugin and one IBarcodeScanControl interface. Then there are two Forms that implement IAppPlugin and one of that uses an IBarcodeScanControl.</p>
<h3>The IAppPlugin Interface</h3>
<pre>namespace MEFdemo1.AppContracts
{
    //describe a public appPlugin interface (contract)
    public interface IAppPlugin : IComponent
    {
        Bitmap appBitmap{ get; }
        System.Windows.Forms.DialogResult DialogResult { get; }
        string sAppText { get; }
        string sReturnData { get; }
    }
}</pre>
<h3>An IAppPlugin implementation</h3>
<p>The simple AppPlugin1 Form implements this interface and exports it.</p>
<pre><div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Collections.Generic</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Drawing</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Text</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Windows.Forms</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel.Composition</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">MEFdemo1.AppContracts</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">namespace</span> AppPlugin1</div></li><li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#91;</span>PartCreationPolicy<span class="br0">&#40;</span>CreationPolicy.<span class="me1">NonShared</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#91;</span>Export<span class="br0">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span class="kw3">typeof</span></a><span class="br0">&#40;</span>IAppPlugin<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">public</span> <span class="kw1">partial</span> <span class="kw4">class</span> UserForm1 <span class="sy0">:</span> Form, IAppPlugin</div></li><li class="li1"><div class="de1">    <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">...</div></li></ol></pre></div></div></pre>
<h3>The AppPlugin2 uses IBarcodeControl</h3>
<p>This form imports the IBarcodeControl and exports IAppPlugin.</p>
<pre><div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Collections.Generic</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Data</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Drawing</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Text</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.Windows.Forms</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel.Composition</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel.Composition.Hosting</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">System.ComponentModel.Composition.Diagnostics</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">MEFdemo1.HAL.DeviceControlContracts</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw1">using</span> <span class="co3">MEFdemo1.AppContracts</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">namespace</span> AppPlugin2</div></li><li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#91;</span>PartCreationPolicy<span class="br0">&#40;</span>CreationPolicy.<span class="me1">NonShared</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#91;</span>Export<span class="br0">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span class="kw3">typeof</span></a><span class="br0">&#40;</span>IAppPlugin<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">public</span> <span class="kw1">partial</span> <span class="kw4">class</span> BarcodeForm <span class="sy0">:</span> Form, IAppPlugin</div></li><li class="li1"><div class="de1">    <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    ...</div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="co1">//[Import(typeof(IBarcodeScanControl))]</span></div></li><li class="li1"><div class="de1">        <span class="co1">//if Import is used here, the catalog is unable to find the control!</span></div></li><li class="li1"><div class="de1">        <span class="kw1">private</span> IBarcodeScanControl conScan<span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        DirectoryCatalog catalog2<span class="sy0">;</span></div></li><li class="li1"><div class="de1">        CompositionContainer container2<span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        <span class="kw1">public</span> BarcodeForm<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            InitializeComponent<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">try</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="kw4">string</span> sPath<span class="sy0">=</span><span class="st0">&quot;&quot;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                <span class="kw1">if</span> <span class="br0">&#40;</span>isIntermec<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">                    sPath <span class="sy0">=</span> <span class="st0">&quot;MEFdemo1.HAL.Intermec.*Control*.dll&quot;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                <span class="kw1">else</span></div></li><li class="li1"><div class="de1">                    sPath <span class="sy0">=</span> <span class="st0">&quot;MEFdemo1.HAL.ACME.*Control*.dll&quot;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                <span class="co1">//I was unable to use the different catalog and let it look in a subfolder</span></div></li><li class="li1"><div class="de1">                <span class="co1">//so the plugin names are used as a filter</span></div></li><li class="li1"><div class="de1">                catalog2 <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> DirectoryCatalog<span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span>, sPath<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="kw4">string</span> s <span class="kw1">in</span> catalog2.<span class="me1">LoadedFiles</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">                    <span class="kw5">System.<span class="me1">Diagnostics</span></span>.<span class="me1">Debug</span>.<span class="me1">WriteLine</span><span class="br0">&#40;</span>s<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                container2 <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> CompositionContainer<span class="br0">&#40;</span>catalog2<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                container2.<span class="me1">ComposeParts</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">...</div></li></ol></pre></div></div></pre>
<p>The usable BarcodeControl is loaded by using a different file pattern for the DirectoryCatalog. So only one BarcodeControl is loaded.</p>
<h3>The MainForm</h3>
<p>The main form scans the application dir for IAppPlugins and lists them using there bitmap property.</p>
<pre><div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">        <span class="co1">//we will import all available plugins</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#91;</span>ImportMany<span class="br0">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span class="kw3">typeof</span></a><span class="br0">&#40;</span>IAppPlugin<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">        <span class="kw1">private</span> <span class="kw4">int</span> iPluginCount <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        DirectoryCatalog catalog<span class="sy0">;</span></div></li><li class="li1"><div class="de1">        CompositionContainer container<span class="sy0">;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">        <span class="kw1">public</span> MainForm<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            InitializeComponent<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">try</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                catalog <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> DirectoryCatalog<span class="br0">&#40;</span><span class="st0">&quot;.&quot;</span>, <span class="st0">&quot;MEFdemo1.Plugins.*.dll&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                container <span class="sy0">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span class="kw3">new</span></a> CompositionContainer<span class="br0">&#40;</span>catalog<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                container.<span class="me1">ComposeParts</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                drawPlugins<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">catch</span> <span class="br0">&#40;</span>Exception ex<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                MessageBox.<span class="me1">Show</span><span class="br0">&#40;</span><span class="st0">&quot;No Plugins loaded: &quot;</span> <span class="sy0">+</span> ex.<span class="me1">Message</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li></ol></pre></div></div></pre>
<p>drawPlugins will draw the images inside MainForm using pictureboxes and applies a click handler for these.</p>
<pre><div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="csharp" style="font-family:monospace;"><ol><li class="li1"><div class="de1">        <span class="kw1">void</span> MainForm_Click<span class="br0">&#40;</span><span class="kw4">object</span> sender, EventArgs e<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="kw4">string</span> sApp <span class="sy0">=</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>PictureBox<span class="br0">&#41;</span>sender<span class="br0">&#41;</span>.<span class="me1">Tag</span>.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="kw5">System.<span class="me1">Diagnostics</span></span>.<span class="me1">Debug</span>.<span class="me1">WriteLine</span><span class="br0">&#40;</span>sApp<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="kw1">foreach</span> <span class="br0">&#40;</span>IAppPlugin iApp <span class="kw1">in</span> plugins<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="kw1">if</span> <span class="br0">&#40;</span>iApp.<span class="me1">sAppText</span>.<span class="me1">Equals</span><span class="br0">&#40;</span>sApp<span class="br0">&#41;</span><span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">                <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                    <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw5">System</span>.<span class="me1">Windows</span>.<span class="me1">Forms</span>.<span class="me1">Form</span><span class="br0">&#41;</span>iApp<span class="br0">&#41;</span>.<span class="me1">ShowDialog</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">                    continue<span class="sy0">;</span></div></li><li class="li1"><div class="de1">                <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li></ol></pre></div></div></pre>
<p>Here is a screenshot of the composed parts:</p>
<p><a href="http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/mainform/" rel="attachment wp-att-1330"><img class="alignnone size-full wp-image-1330" title="mainform" src="http://www.hjgode.de/wp/wp-content/uploads/2012/02/mainform.gif" alt="" width="240" height="320" /></a></p>
<p>When you click one of the pictureboxes, the plugins form is shown: either the BarcodeForm or the simple UserForm:</p>
<p><a href="http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/barcodeform/" rel="attachment wp-att-1329"><img class="alignnone size-full wp-image-1329" title="barcodeform" src="http://www.hjgode.de/wp/wp-content/uploads/2012/02/barcodeform.gif" alt="" width="240" height="320" /></a>  <a href="http://www.hjgode.de/wp/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/userform/" rel="attachment wp-att-1331"><img class="alignnone size-full wp-image-1331" title="UserForm" src="http://www.hjgode.de/wp/wp-content/uploads/2012/02/UserForm.gif" alt="" width="240" height="320" /></a></p>
<p>The programs dir reflects all the contracts and plugins:</p>
<pre>intermec.datacollection.cf3.5.dll                            intermec barcode hardware wrapper
intermec.devicemanagement.smartsystem.itcssapi.dll           intermec software wrapper
MEFdemo1.exe                                                 the application
mefdemo1.appcontracts.dll                                    the AppPlugin contract
mefdemo1.devicecontrolcontracts.dll                          the BarcodePlugin contract
MEFdemo1.HAL.ACME.BarcodeControl2.dll                        one BarcodeControl (the generic implementation)
MEFdemo1.HAL.Intermec.BarcodeControl1.dll                    second BarcodeControl (intermec dependent)
MEFdemo1.Plugins.AppPlugin1.dll                              the UserForm application plugin
MEFdemo1.Plugins.AppPlugin2.dll                              the BarcodeForm application plugin
pocket.componentmodel.initialization.dll                     PocketMEF runtime
pocket.system.componentmodel.composition.dll                 PocketMEF runtime</pre>
<p>If you remove one of the AppPlugin DLL files and then start MEFdemo, only the remaining Plugin is shown.</p>
<p>Although I implemented all plugins in there own class library projects, you can combine multiple plugins into one project and so will get less DLLs. The disadvantage is that you cant simply update only one these plugins, you have then to replace the whole lib.</p>
<p>Source code is hosted at code.google.com/p/pocketmef/source/</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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%2F&amp;title=Mobile+Development+%26%238211%3B+Compact+Framework%3A+Managed+Extension+Framework+%28MEF%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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%2F&amp;title=Mobile+Development+%26%238211%3B+Compact+Framework%3A+Managed+Extension+Framework+%28MEF%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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%2F&amp;title=Mobile+Development+%26%238211%3B+Compact+Framework%3A+Managed+Extension+Framework+%28MEF%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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%2F&amp;T=Mobile+Development+%26%238211%3B+Compact+Framework%3A+Managed+Extension+Framework+%28MEF%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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%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%2F2012%2F02%2F16%2Fmobile-development-compact-framework-managed-extension-framework-mef%2F&amp;t=Mobile+Development+%26%238211%3B+Compact+Framework%3A+Managed+Extension+Framework+%28MEF%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/2012/02/16/mobile-development-compact-framework-managed-extension-framework-mef/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Developement &#8211; RDP AutoLogin extended (version 4)</title>
		<link>http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-developement-rdp-autologin-extended-version-4</link>
		<comments>http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:53:56 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1299</guid>
		<description><![CDATA[Hello 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>on the wish of the one or other user I extended the RDP AutoLogin code and we now reached level 4.</p>
<p>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.</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="text" style="font-family:monospace;"><ol><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">Domain:s:</div></li><li class="li1"><div class="de1">ColorDepthID:i:3</div></li><li class="li1"><div class="de1">ScreenStyle:i:0</div></li><li class="li1"><div class="de1">DesktopWidth:i:640</div></li><li class="li1"><div class="de1">DesktopHeight:i:480</div></li><li class="li1"><div class="de1">UserName:s:rdesktop</div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">ServerName:s:192.168.128.5</div></li><li class="li1"><div class="de1">SavePassword:i:1</div></li><li class="li1"><div class="de1">...</div></li></ol></pre></div></div>
<p>The color depth setting supports two modes, 8 Bit with 256b colors (ColorDepthID:i:1) and 16 Bit with ~65000 colors (ColorDepthID:i:3).</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="reg" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="geshi_registry_header">REGEDIT4</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="br0">&#91;</span><span class="kw3">HKEY_LOCAL_MACHINE</span>\Software\RDP_autologin<span class="br0">&#93;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;FitToScreen&quot;</span><span class="sy0">=</span><span class="st0">&quot;1&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;FullScreen&quot;</span><span class="sy0">=</span><span class="st0">&quot;1&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Status&quot;</span><span class="sy0">=</span><span class="st0">&quot;connecting...&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Save Password&quot;</span><span class="sy0">=</span><span class="st0">&quot;1&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Domain&quot;</span><span class="sy0">=</span><span class="st0">&quot;&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Password&quot;</span><span class="sy0">=</span><span class="st0">&quot;Intermec+2004&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Username&quot;</span><span class="sy0">=</span><span class="st0">&quot;rdesktop&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;Computer&quot;</span><span class="sy0">=</span><span class="st0">&quot;192.168.0.130&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;DesktopWidth&quot;</span><span class="sy0">=</span>640</div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;DesktopHeight&quot;</span><span class="sy0">=</span>480</div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;startOnExit&quot;</span><span class="sy0">=</span><span class="st0">&quot;\\rdp_keepBusy.exe&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;execargs&quot;</span><span class="sy0">=</span><span class="st0">&quot;noRDPstart&quot;</span></div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;UseMouseClick&quot;</span><span class="sy0">=</span>&quot;0&quot;	//added with version 3 to switch between mouse and keyboard simulation</div></li><li class="li1"><div class="de1"><span class="geshi_variable">&quot;ColorDepth&quot;</span><span class="sy0">=</span>1		//added with version 4 to enable switching between 8 and 16 Bit colors</div></li></ol></pre></div></div>
<p>The code changes are small. Some code addition to read the value from the registry and some to write the rdp file:</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw4">void</span> readReg<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">        <span class="co1">//ColorDepth new with version 4</span></div></li><li class="li1"><div class="de1">        <span class="kw1">if</span><span class="br0">&#40;</span>RegReadDword<span class="br0">&#40;</span>L<span class="st0">&quot;ColorDepth&quot;</span>, <span class="sy3">&amp;</span>dwTemp<span class="br0">&#41;</span> <span class="sy1">==</span> 0<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">            dwColorDepth<span class="sy1">=</span>dwTemp<span class="sy4">;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="kw4">void</span> writeRDP<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1">			<span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>wcsstr<span class="br0">&#40;</span>rdpLines<span class="br0">&#91;</span>c<span class="br0">&#93;</span>.<span class="me1">line</span>, L<span class="st0">&quot;ColorDepthID&quot;</span><span class="br0">&#41;</span><span class="sy3">!</span><span class="sy1">=</span><span class="kw2">NULL</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				wsprintf<span class="br0">&#40;</span>szTemp, rdpLines<span class="br0">&#91;</span>c<span class="br0">&#93;</span>.<span class="me1">line</span>, dwColorDepth<span class="br0">&#41;</span><span class="sy4">;</span>  <span class="co1">//3=HighColor(16Bit) or 1=(8Bit) color</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>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:</p>
<p><span id="more-1299"></span></p>
<p><a href="http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/clipboard01-2/" rel="attachment wp-att-1300"><img class="alignnone size-full wp-image-1300" title="Clipboard01" src="http://www.hjgode.de/wp/wp-content/uploads/2012/01/Clipboard01.gif" alt="" width="240" height="320" /></a>  <a href="http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/clipboard02-2/" rel="attachment wp-att-1301"><img class="alignnone size-full wp-image-1301" title="Clipboard02" src="http://www.hjgode.de/wp/wp-content/uploads/2012/01/Clipboard02.gif" alt="" width="240" height="320" /></a> <a href="http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/clipboard03/" rel="attachment wp-att-1302"><img class="alignnone size-full wp-image-1302" title="Clipboard03" src="http://www.hjgode.de/wp/wp-content/uploads/2012/01/Clipboard03.gif" alt="" width="240" height="320" /></a><a href="http://www.hjgode.de/wp/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/clipboard04/" rel="attachment wp-att-1303"> <img class="alignnone size-full wp-image-1303" title="Clipboard04" src="http://www.hjgode.de/wp/wp-content/uploads/2012/01/Clipboard04.gif" alt="" width="240" height="320" /></a></p>
<p>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 &#8220;\My Documents&#8221;.</p>
<p>RDP AutoLogin Settings Editor (exe): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=150" title="Downloaded 80 times">RDP AutoLogin Settings editor</a> -  (Hits: 80, size: 10.45 kB)<br />
source (Visual Studio 2008 WM5 SDK project): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=151" title="Downloaded 52 times">RDP AutoLogin Settings editor Source Code</a> -  (Hits: 52, size: 21.23 kB)</p>
<p>RDP_AutoLogin (exe): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=152" title="Downloaded 74 times">RDP AutoLogin Executable</a> -  (Hits: 74, size: 6.78 kB)<br />
source (Visual Studio 2008 WM5 SDK project): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=153" title="Downloaded 52 times">RDP AutoLogin Source Code</a> -  (Hits: 52, size: 56.85 kB)</p>
<p>RDP_KeepBusy (exe): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=155" title="Downloaded 62 times">RDP KeepBusy (executable)</a> -  (Hits: 62, size: 3.17 kB)<br />
RDP_KeepBusy (vs2008 WM5 SDK project): <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=154" title="Downloaded 49 times">RDP KeepBusy Source Code</a> -  (Hits: 49, size: 12.92 kB)</p>
<p>Have fun</p>
<p>Josef</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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%2F&amp;title=Mobile+Developement+%26%238211%3B+RDP+AutoLogin+extended+%28version+4%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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%2F&amp;title=Mobile+Developement+%26%238211%3B+RDP+AutoLogin+extended+%28version+4%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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%2F&amp;title=Mobile+Developement+%26%238211%3B+RDP+AutoLogin+extended+%28version+4%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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%2F&amp;T=Mobile+Developement+%26%238211%3B+RDP+AutoLogin+extended+%28version+4%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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%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%2F2012%2F01%2F03%2Fmobile-developement-rdp-autologin-extended-version-4%2F&amp;t=Mobile+Developement+%26%238211%3B+RDP+AutoLogin+extended+%28version+4%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/2012/01/03/mobile-developement-rdp-autologin-extended-version-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Mobile &#8211; tasker2 runs and stops applications periodically</title>
		<link>http://www.hjgode.de/wp/2011/12/23/windows-mobile-tasker2-runs-and-stops-applications-periodically/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-mobile-tasker2-runs-and-stops-applications-periodically</link>
		<comments>http://www.hjgode.de/wp/2011/12/23/windows-mobile-tasker2-runs-and-stops-applications-periodically/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 13:11:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[notification API]]></category>
		<category><![CDATA[periodically]]></category>
		<category><![CDATA[schedule]]></category>
		<category><![CDATA[tasker2]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1286</guid>
		<description><![CDATA[Tasker2 is a tool to launch or kill applications periodically using windows mobile scheduler. It was born to control the running of agent software on windows mobile at specified times. The problem with the agent software was that it does not open/close connections only on usage times but all the time and the device&#8217;s battery [...]]]></description>
			<content:encoded><![CDATA[<p>Tasker2 is a tool to launch or kill applications periodically using windows mobile scheduler. It was born to control the running of agent software on windows mobile at specified times. The problem with the agent software was that it does not open/close connections only on usage times but all the time and the device&#8217;s battery was drain very fast. We decided to write a helper that would launch and kill the agent to have it running only within a defined time frame.</p>
<h2>Background process</h2>
<p>We could have written a background process to run external tasks periodically. But the main disadvantage of timers and threads in background processes is that they do not run, if the device is in suspend mode.<br />
To ensure that tasks will be launched also if the device is sleeping, we decided to use the windows mobile scheduler. There are functions inside the notification API to create notifications that will run an application at a specified time. This is what we call a schedule.</p>
<h2>The scheduler (notification API)</h2>
<p>After a timed schedule has been done by the scheduler, the schedule is removed from the notification database. If you like to have a periodic schedule, you have to ensure that a new schedule is created inside your code.</p>
<h2>Pitfalls</h2>
<p>During development we found many pitfalls in conjunction with the windows mobile scheduler. This is why I decided to write this post.</p>
<h2>The tasks</h2>
<p>Tasker2 is a console application without any GUI but it will write a log with all you need to know. Tasker2 supports up to ten tasks. A task is defined using the registry. Every task has an entry for start and stop times, the application to control, an interval for the schedule and a flag for control if a task is only to be run on external power:</p>
<pre>REGEDIT4

[HKLM\Software\Tasker\Task1]
"active":DWORD=1
"exe":="\Windows\fexplore.exe"
"arg":="\My Documents"
"start":="1423"
"stop":="1523"
"interval":="2400"
"startOnAConly":DWORD=0;</pre>
<p><strong>active</strong>: if active is 0, tasker2 will not kill or start the process<br />
<strong>exe</strong>: name of the process executable to start or kill<br />
<strong>arg</strong>: arguments to be when launching the executable<br />
<strong>start</strong>: when to start the executable the next time<br />
<strong>stop</strong>: when to kill the process the next time<br />
<strong>interval</strong>: when a start or kill has been executed, tasker2 will create a new schedule using this interval. If the interval is &#8220;0010&#8243;, the start process will be scheduled for every 10 minutes.<br />
<strong>startOnAConly</strong>: if 1 and when a process has to be started, the process will only be started if the device is on external power</p>
<h2>The scheduler</h2>
<p>First, tasker2 is normally only launched one time manually and all future calls are made by the scheduler. Tasker2 will clear and schedule all planned tasks as defined in the registry if it is launched without arguments.</p>
<p><a href="http://www.hjgode.de/wp/2011/12/23/windows-mobile-tasker2-runs-and-stops-applications-periodically/notification-schedules/" rel="attachment wp-att-1287"><img class="alignnone size-full wp-image-1287" title="notification-schedules" src="http://www.hjgode.de/wp/wp-content/uploads/2011/12/notification-schedules.gif" alt="" width="320" height="240" /></a></p>
<p><span id="more-1286"></span>The scheduler is a task manager running all the time in windows mobile. If a timed schedule is reached, the scheduler will launch the specified application, see also <a href="http://www.hjgode.de/wp/2009/07/14/howto-run-an-application-periodically/">here</a> . This will also work if the device is in suspend mode (sleeps). The scheduler can also fire on special events like time or hardware changes (ON_RS232_CONNECT for example). See also my post <a href="http://www.hjgode.de/wp/2010/03/06/irunatevent/">here</a> [http://www.hjgode.de/wp/2010/03/06/irunatevent/].</p>
<h2>Theory of operation</h2>
<p>Tasker2 uses command line arguments to control itself. The scheduler launches tasker2 with the specified arguments and tasker2 will then run or kill the defined task.</p>
<p><a href="http://www.hjgode.de/wp/2011/12/23/windows-mobile-tasker2-runs-and-stops-applications-periodically/tasker-function/" rel="attachment wp-att-1288"><img class="alignnone size-full wp-image-1288" title="tasker-function" src="http://www.hjgode.de/wp/wp-content/uploads/2011/12/tasker-function.gif" alt="" width="800" height="502" /></a></p>
<h2>Delayed schedules (pitfall 1)</h2>
<p>If your device supports a real power down, the scheduler will not awake the device and is not able to launch the defined schedules. When the device is later powered on, it will schedule all past schedules at once. This is what we call a &#8216;delayed schedule&#8217; and a flooding of launches. Flooding in the mean of many schedules of tasker2 occurring at the same time for past tasks.<br />
To avoid concurrent changes to the registry and scheduler entries, tasker2 uses a mutex to ensure only one instance is continuing execution. Subsequent instances will wait for existing instances before they do there work.</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="co1">//##################### dont run if already running #############################</span></div></li><li class="li1"><div class="de1">	nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Checking for Mutex (single instance allowed only)...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	hMutex<span class="sy1">=</span>CreateMutex<span class="br0">&#40;</span><span class="kw2">NULL</span>, TRUE, MY_MUTEX<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">if</span><span class="br0">&#40;</span>hMutex<span class="sy1">==</span><span class="kw2">NULL</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		<span class="co1">//this should never happen</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Error in CreateMutex! GetLastError()=%i<span class="es1">\n</span>&quot;</span>, GetLastError<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;-------- END -------<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">return</span> <span class="sy2">-</span><span class="nu0">99</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">	DWORD dwLast <span class="sy1">=</span> GetLastError<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">if</span><span class="br0">&#40;</span>dwLast<span class="sy1">==</span> ERROR_ALREADY_EXISTS<span class="br0">&#41;</span><span class="br0">&#123;</span><span class="co1">//mutex already exists, wait for mutex release</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>Attached to existing mutex<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;................ Waiting for mutex release......<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		WaitForSingleObject<span class="br0">&#40;</span> hMutex, INFINITE <span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;++++++++++++++++ Mutex released. +++++++++++++++<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>Created new mutex<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="co1">//##################### dont run if already running #############################</span></div></li></ol></pre></div></div>
<p>On a delayed, flooding schedule ALL pending tasks are scheduled and possibly a Time_Changed string is sent to the pending tasks. This flooding will be serialized as tasker2 waits for existing tasker2 instances.</p>
<h2>Time and time zone changes (pitfall 2)</h2>
<p>When the time is changed on the device, the scheduler will inform all timed tasks. Tasker2 must then recalculate new schedules based on current local time. The scheduler launches the defined applications with the TIME_CHANGED string as argument.</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>wcsicmp<span class="br0">&#40;</span>argv<span class="br0">&#91;</span>1<span class="br0">&#93;</span>, APP_RUN_AFTER_TIME_CHANGE<span class="br0">&#41;</span><span class="sy1">==</span>0 <span class="sy3">||</span> wcsicmp<span class="br0">&#40;</span>argv<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>, APP_RUN_AFTER_TZ_CHANGE<span class="br0">&#41;</span><span class="sy1">==</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;got '%s' signaled<span class="es1">\n</span>&quot;</span>, argv<span class="br0">&#91;</span>1<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="co1">//better to reread the current time we work with, possibly we have been blocked</span></div></li><li class="li1"><div class="de1">				g_tmCurrentStartTime<span class="sy1">=</span>getLocalTime<span class="br0">&#40;</span><span class="sy3">&amp;</span>g_tmCurrentStartTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="co1">//now again check if we have a valid date</span></div></li><li class="li1"><div class="de1">				nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Checking for valid date/time...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>g_tmCurrentStartTime.<span class="me1">tm_year</span><span class="sy2">+</span><span class="nu0">1900</span><span class="br0">&#41;</span><span class="sy2">*</span><span class="nu0">100</span> <span class="sy2">+</span> g_tmCurrentStartTime.<span class="me1">tm_mon</span><span class="sy2">+</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="sy1">&lt;</span> <span class="nu0">201111</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">					nclog<span class="br0">&#40;</span>L<span class="st0">&quot;scheduling event notifications<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="co1">//clear and renew all event notifications</span></div></li><li class="li1"><div class="de1">					<span class="co2">#ifndef TESTMODE</span></div></li><li class="li1"><div class="de1">						RunAppAtTimeChangeEvents<span class="br0">&#40;</span>szTaskerEXE<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="co2">#endif</span></div></li><li class="li1"><div class="de1">					nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Date/Time not valid!<span class="es1">\n</span>*********** END ************<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">return</span> <span class="nu12">0xBADCAB1E</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">				nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Date/Time after 11 2011. OK<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">			<span class="co1">//schedule all active tasks</span></div></li><li class="li1"><div class="de1">			<span class="kw4">int</span> iCount <span class="sy1">=</span> scheduleAllTasks<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Scheduled %i Tasks<span class="es1">\n</span>&quot;</span>, iCount<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>Additionally we found that the time changes may also occur during program launch or as tasker2 instances wait for another tasker2 instance. So tasker2 uses only one (in real two) calls to get the current time. This is essential, as tasker2 uses the current time to re-schedule tasks. The current time is called at the beginning, before tasker2 waits for the mutex. This is the time tasker2 was launched. If there has been a time_changed schedule, tasker2 will use another call to the current time, as it may have changed between the launch and the further execution of the code &#8211; after the mutex is released and the current instance is allowed to run.</p>
<h2>Delayed schedules II (pitfall 3)</h2>
<p>As only one instance of tasker2 is executing, it may happen, that the current time and the task time do not match exactly. Although the scheduler may do its best to launch tasker2 at the right time, the execution may be delayed in regards of the time the task is to be scheduled and the current time. This is another delayed schedule compared to the above flooding of schedules after a power down/up cycle.<br />
It may also happen that a lot of tasker2 instances are waiting for execution, you know that we can have up to ten tasks. This may also lead to &#8216;delayed&#8217; code execution, but should be in a small time frame of some minutes only.<br />
Therefor tasker2 supports a maximum allowed delay time to distinguish between allowed and flooding delayed calls.</p>
<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="co1">//is this a delayed schedule?</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>checking for delayed schedule...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw4">int</span> iDeltaMinutes<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttStart<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttStop<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttCurr<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttStop <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttStart <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttCurr <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span>g_tmCurrentStartTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			<span class="co1">//difftime(timer1, timer0) returns the elapsed time in seconds, from timer0 to timer1</span></div></li><li class="li1"><div class="de1">			iDeltaMinutes <span class="sy1">=</span> <span class="kw3">difftime</span><span class="br0">&#40;</span>ttCurr, ttStop<span class="br0">&#41;</span><span class="sy2">/</span><span class="nu0">60</span><span class="sy4">;</span><span class="co1">// stDeltaMinutes(_Tasks[iTask].stStopTime, g_CurrentStartTime);</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;stStopTime = '%s', &quot;</span>, getLongStrFromTM<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			iDeltaMinutes <span class="sy1">=</span> <span class="kw3">difftime</span><span class="br0">&#40;</span>ttStart, ttCurr<span class="br0">&#41;</span><span class="sy2">/</span><span class="nu0">60</span><span class="sy4">;</span><span class="co1">// stDeltaMinutes(_Tasks[iTask].stStartTime, g_CurrentStartTime);</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;stStartTime = '%s', &quot;</span>, getLongStrFromTM<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li></ol></pre></div></div>
<h2>Adding a schedule</h2>
<p>I am using central functions in code to add or remove schedules. Here is a sample of how a schedule is added:</p>
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#include &quot;notify.h&quot;</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co1">//--------------------------------------------------------------------</span></div></li><li class="li1"><div class="de1"><span class="co1">// Function name  : ScheduleRunApp</span></div></li><li class="li1"><div class="de1"><span class="co1">// Description    : add a schedule for exe with args at the time</span></div></li><li class="li1"><div class="de1"><span class="co1">// Argument       : LPCTSTR szExeName</span></div></li><li class="li1"><div class="de1"><span class="co1">// Argument       : LPCTSTR szArgs</span></div></li><li class="li1"><div class="de1"><span class="co1">// Argument       : struct tm tmTime</span></div></li><li class="li1"><div class="de1"><span class="co1">// Return type    : HRESULT, 0 for no error</span></div></li><li class="li1"><div class="de1"><span class="co1">//--------------------------------------------------------------------</span></div></li><li class="li1"><div class="de1">HRESULT ScheduleRunApp<span class="br0">&#40;</span>LPCTSTR szExeName, LPCTSTR szArgs, <span class="kw4">struct</span> <span class="kw4">tm</span> tmTime<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	HRESULT hr <span class="sy1">=</span> S_OK<span class="sy4">;</span></div></li><li class="li1"><div class="de1">	HANDLE hNotify <span class="sy1">=</span> <span class="kw2">NULL</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="co1">// set a CE_NOTIFICATION_TRIGGER</span></div></li><li class="li1"><div class="de1">	CE_NOTIFICATION_TRIGGER notifTrigger<span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="kw3">memset</span><span class="br0">&#40;</span><span class="sy3">&amp;</span>notifTrigger, 0, <span class="kw3">sizeof</span><span class="br0">&#40;</span>CE_NOTIFICATION_TRIGGER<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	notifTrigger.<span class="me1">dwSize</span> <span class="sy1">=</span> <span class="kw3">sizeof</span><span class="br0">&#40;</span>CE_NOTIFICATION_TRIGGER<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="co1">// calculate time</span></div></li><li class="li1"><div class="de1">	SYSTEMTIME st <span class="sy1">=</span> <span class="br0">&#123;</span>0<span class="br0">&#125;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="co1">//GetLocalTime(&amp;st); //v.2.28</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	st <span class="sy1">=</span> convertTM2SYSTEMTIME<span class="br0">&#40;</span><span class="sy3">&amp;</span>st, <span class="sy3">&amp;</span>tmTime<span class="br0">&#41;</span><span class="sy4">;</span> <span class="co1">//use provided new datetime</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	wsprintf<span class="br0">&#40;</span>str, L<span class="st0">&quot;Next run at: %02i.%02i.%02i %02i:%02i:%02i&quot;</span>,</div></li><li class="li1"><div class="de1">										st.<span class="me1">wDay</span>, st.<span class="me1">wMonth</span> , st.<span class="me1">wYear</span>,</div></li><li class="li1"><div class="de1">										st.<span class="me1">wHour</span> , st.<span class="me1">wMinute</span> , st.<span class="me1">wSecond</span> <span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>ScheduleRunApp: %s<span class="es1">\n</span>&quot;</span>, str<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	notifTrigger.<span class="me1">dwType</span> <span class="sy1">=</span> CNT_TIME<span class="sy4">;</span></div></li><li class="li1"><div class="de1">	notifTrigger.<span class="me1">stStartTime</span> <span class="sy1">=</span> st<span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="co1">// timer: execute an exe at specified time</span></div></li><li class="li1"><div class="de1">	notifTrigger.<span class="me1">lpszApplication</span> <span class="sy1">=</span> <span class="br0">&#40;</span>LPTSTR<span class="br0">&#41;</span>szExeName<span class="sy4">;</span></div></li><li class="li1"><div class="de1">	notifTrigger.<span class="me1">lpszArguments</span> <span class="sy1">=</span> <span class="br0">&#40;</span>LPTSTR<span class="br0">&#41;</span>szArgs<span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	hNotify <span class="sy1">=</span> CeSetUserNotificationEx<span class="br0">&#40;</span>0, <span class="sy3">&amp;</span>notifTrigger, <span class="kw2">NULL</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="co1">// NULL because we do not care the action</span></div></li><li class="li1"><div class="de1">	<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy3">!</span>hNotify<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		hr <span class="sy1">=</span> E_FAIL<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>ScheduleRunApp: CeSetUserNotificationEx FAILED...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		<span class="co1">// close the handle as we do not need to use it further</span></div></li><li class="li1"><div class="de1">		CloseHandle<span class="br0">&#40;</span>hNotify<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>ScheduleRunApp: CeSetUserNotificationEx succeeded...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">return</span> hr<span class="sy4">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<h2>The main code</h2>
<p>The main function is processStartStopCmd() beside createNextSchedule(). It does all the scheduling and time calculations.</p>
<div id="wpshdo_16" class="wp-synhighlighter-outer"><div id="wpshdt_16" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_16"></a><a id="wpshat_16" class="wp-synhighlighter-title" href="#codesyntax_16"  onClick="javascript:wpsh_toggleBlock(16)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_16" onClick="javascript:wpsh_code(16)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_16" onClick="javascript:wpsh_print(16)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_16" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="coMULTI">/*	########################################################</span></div></li><li class="li1"><div class="de1"><span class="coMULTI">		Process -s and -k comd line args</span></div></li><li class="li1"><div class="de1"><span class="coMULTI">	########################################################</span></div></li><li class="li1"><div class="de1"><span class="coMULTI">*/</span></div></li><li class="li1"><div class="de1"><span class="co1">//--------------------------------------------------------------------</span></div></li><li class="li1"><div class="de1"><span class="co1">// Function name  : processStartStopCmd</span></div></li><li class="li1"><div class="de1"><span class="co1">// Description    : calc new start/stop time, add schedules and start/kill application</span></div></li><li class="li1"><div class="de1"><span class="co1">// Argument       : TCHAR* argv[], the cmdLine array</span></div></li><li class="li1"><div class="de1"><span class="co1">// Return type    : int, 0 for no error</span></div></li><li class="li1"><div class="de1"><span class="co1">//--------------------------------------------------------------------</span></div></li><li class="li1"><div class="de1"><span class="kw4">int</span> processStartStopCmd<span class="br0">&#40;</span>TCHAR<span class="sy2">*</span> argv<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	<span class="kw4">int</span> iReturn <span class="sy1">=</span> <span class="nu0">0</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	BOOL bIsDelayedSchedule <span class="sy1">=</span> TRUE<span class="sy4">;</span> <span class="co1">//used to save a delayed schedule situation</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="kw2">enum</span> taskType<span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		startTask <span class="sy1">=</span> 1,</div></li><li class="li1"><div class="de1">		stopTask <span class="sy1">=</span> 2</div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	taskType thisTaskType<span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="kw1">if</span><span class="br0">&#40;</span>wcsicmp<span class="br0">&#40;</span>argv<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>, L<span class="st0">&quot;-k&quot;</span><span class="br0">&#41;</span><span class="sy1">==</span><span class="nu0">0</span><span class="br0">&#41;</span>	<span class="co1">//kill taskX app</span></div></li><li class="li1"><div class="de1">		thisTaskType<span class="sy1">=</span>stopTask<span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">else</span></div></li><li class="li1"><div class="de1">		thisTaskType<span class="sy1">=</span>startTask<span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="kw4">int</span> iTask <span class="sy1">=</span> getTaskNumber<span class="br0">&#40;</span>argv<span class="br0">&#91;</span>2<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">if</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">iActive</span><span class="sy1">==</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		<span class="co1">//create a new schedule cmd line for tasker</span></div></li><li class="li1"><div class="de1">		TCHAR strTaskCmdLine<span class="br0">&#91;</span>MAX_PATH<span class="br0">&#93;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">			wsprintf<span class="br0">&#40;</span>strTaskCmdLine, L<span class="st0">&quot;-k task%i&quot;</span>, iTask<span class="sy2">+</span>1<span class="br0">&#41;</span><span class="sy4">;</span> <span class="co1">//the cmdLine for tasker.exe for this task</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span></div></li><li class="li1"><div class="de1">			wsprintf<span class="br0">&#40;</span>strTaskCmdLine, L<span class="st0">&quot;-s task%i&quot;</span>, iTask<span class="sy2">+</span>1<span class="br0">&#41;</span><span class="sy4">;</span> <span class="co1">//the cmdLine for tasker.exe for this task	</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="co1">//clear all tasker schedules for taskX</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Clearing all schedules for Task%i with '%s'<span class="es1">\n</span>&quot;</span>, iTask<span class="sy2">+</span>1, strTaskCmdLine<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		notiClearRunApp<span class="br0">&#40;</span>szTaskerEXE, strTaskCmdLine<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw4">struct</span> <span class="kw4">tm</span> tmNewTime <span class="sy1">=</span> <span class="br0">&#123;</span>0<span class="br0">&#125;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw4">short</span> shHour	<span class="sy1">=</span>	_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stDiffTime</span>.<span class="me1">tm_hour</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw4">short</span> shMin		<span class="sy1">=</span>	_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stDiffTime</span>.<span class="me1">tm_min</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw4">short</span> shDays	<span class="sy1">=</span>	<span class="nu0">0</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>shHour<span class="sy1">&gt;=</span><span class="nu0">24</span><span class="br0">&#41;</span><span class="br0">&#123;</span>	<span class="co1">//hour interval value is one day or more</span></div></li><li class="li1"><div class="de1">			shDays <span class="sy1">=</span> <span class="br0">&#40;</span><span class="kw4">short</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>shHour <span class="sy2">/</span> 24<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			shHour <span class="sy1">=</span> <span class="br0">&#40;</span><span class="kw4">short</span><span class="br0">&#41;</span> <span class="br0">&#40;</span>shHour <span class="sy2">%</span> 24<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span>				</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="co1">//is this a delayed schedule?</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>checking for delayed schedule...<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw4">int</span> iDeltaMinutes<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttStart<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttStop<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		__time64_t ttCurr<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttStop <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttStart <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		ttCurr <span class="sy1">=</span> _mktime64<span class="br0">&#40;</span><span class="sy3">&amp;</span>g_tmCurrentStartTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			<span class="co1">//difftime(timer1, timer0) returns the elapsed time in seconds, from timer0 to timer1</span></div></li><li class="li1"><div class="de1">			iDeltaMinutes <span class="sy1">=</span> <span class="kw3">difftime</span><span class="br0">&#40;</span>ttCurr, ttStop<span class="br0">&#41;</span><span class="sy2">/</span><span class="nu0">60</span><span class="sy4">;</span><span class="co1">// stDeltaMinutes(_Tasks[iTask].stStopTime, g_CurrentStartTime);</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;stStopTime = '%s', &quot;</span>, getLongStrFromTM<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			iDeltaMinutes <span class="sy1">=</span> <span class="kw3">difftime</span><span class="br0">&#40;</span>ttStart, ttCurr<span class="br0">&#41;</span><span class="sy2">/</span><span class="nu0">60</span><span class="sy4">;</span><span class="co1">// stDeltaMinutes(_Tasks[iTask].stStartTime, g_CurrentStartTime);</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;stStartTime = '%s', &quot;</span>, getLongStrFromTM<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;current time = '%s'<span class="es1">\n</span>&quot;</span>, getLongStrFromTM<span class="br0">&#40;</span>g_tmCurrentStartTime<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;interval is: %id%02ih%02im<span class="es1">\n</span>&quot;</span>, shDays, shHour, shMin<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>delta is %i minutes<span class="es1">\n</span>&quot;</span>, iDeltaMinutes<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="co1">//started BEFORE scheduled time, iDelta is negative</span></div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>iDeltaMinutes<span class="sy1">&lt;</span>0<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				<span class="co1">//calculate new schedules or leave them as is?</span></div></li><li class="li1"><div class="de1">				<span class="co1">//tmNewTime=_Tasks[iTask].stStopTime;	//leave them as is</span></div></li><li class="li1"><div class="de1">				tmNewTime<span class="sy1">=</span>createNextSchedule<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span>, shDays,shHour,shMin<span class="br0">&#41;</span><span class="sy4">;</span> <span class="co1">//calc new schedule</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				<span class="co1">//tmNewTime=_Tasks[iTask].stStartTime;	//leave them as is</span></div></li><li class="li1"><div class="de1">				tmNewTime<span class="sy1">=</span>createNextSchedule<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span>, shDays,shHour,shMin<span class="br0">&#41;</span><span class="sy4">;</span> <span class="co1">//calc new schedule</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="co2">#ifndef TESTMODE</span></div></li><li class="li1"><div class="de1">			ScheduleRunApp<span class="br0">&#40;</span>szTaskerEXE, strTaskCmdLine, tmNewTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1"><span class="co2">#endif</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;*** re-scheduled future task *** <span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">return</span> <span class="nu0">0</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw4">int</span> iMaxDelay <span class="sy1">=</span> getMaxDelay<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>max allowed diff for delayed schedule recognition is plus %i<span class="es1">\n</span>&quot;</span>, iMaxDelay<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span> iDeltaMinutes <span class="sy1">&gt;</span> iMaxDelay <span class="br0">&#41;</span> <span class="co1">//is the time diff greater than 1 minute</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			bIsDelayedSchedule <span class="sy1">=</span> TRUE<span class="sy4">;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;*** delayed schedule *** recognized<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="co1">//this is a delayed schedule</span></div></li><li class="li1"><div class="de1">			DOUBLE dbTimeDiff <span class="sy1">=</span> <span class="nu0">0</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">			<span class="co1">//it may happen that the schedule is far in the future</span></div></li><li class="li1"><div class="de1">			<span class="co1">//we calc the next schedule on base of the current time by using the saved start/stop time</span></div></li><li class="li1"><div class="de1">			<span class="co1">//is just greater than the current time</span></div></li><li class="li1"><div class="de1">			<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">				tmNewTime<span class="sy1">=</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">else</span></div></li><li class="li1"><div class="de1">				tmNewTime<span class="sy1">=</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">			tmNewTime <span class="sy1">=</span> createNextSchedule<span class="br0">&#40;</span>tmNewTime, shDays, shHour, shMin<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;*** NO delayed schedule *** recognized<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				tmNewTime <span class="sy1">=</span> createNextSchedule<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStopTime</span>, shDays, shHour, shMin<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				tmNewTime <span class="sy1">=</span> createNextSchedule<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">stStartTime</span>, shDays, shHour, shMin<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			bIsDelayedSchedule<span class="sy1">=</span>FALSE<span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="co1">//create a new kill or start schedule with new time</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Creating new schedule for '%s' in Task%i<span class="es1">\n</span>&quot;</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span>, iTask<span class="sy2">+</span>1<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1"><span class="co2">#ifndef TESTMODE</span></div></li><li class="li1"><div class="de1">		ScheduleRunApp<span class="br0">&#40;</span>szTaskerEXE, strTaskCmdLine, tmNewTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1"><span class="co2">#endif</span></div></li><li class="li1"><div class="de1">		<span class="co1">//save new changed stop/start ime</span></div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>stopTask<span class="br0">&#41;</span></div></li><li class="li1"><div class="de1">			regSetStopTime<span class="br0">&#40;</span>iTask, tmNewTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span></div></li><li class="li1"><div class="de1">			regSetStartTime<span class="br0">&#40;</span>iTask, tmNewTime<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">if</span><span class="br0">&#40;</span><span class="sy3">!</span>bIsDelayedSchedule<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Not a delayed schedule<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">if</span><span class="br0">&#40;</span>thisTaskType<span class="sy1">==</span>startTask<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">				<span class="kw1">if</span><span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">bStartOnAConly</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">if</span><span class="br0">&#40;</span>isACpowered<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">						nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Starting exe '%s' as on AC power<span class="es1">\n</span>&quot;</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">						runExe<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szArgs</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">						nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Skipping start of exe '%s' as not on AC power<span class="es1">\n</span>&quot;</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">				<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">				<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">					nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Starting exe '%s'<span class="es1">\n</span>&quot;</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					runExe<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szArgs</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			<span class="kw1">else</span><span class="br0">&#123;</span> <span class="co1">// a stop task</span></div></li><li class="li1"><div class="de1">				<span class="co1">//now kill the task's exe</span></div></li><li class="li1"><div class="de1">				nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Killing exe '%s'<span class="es1">\n</span>&quot;</span>, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				DWORD iKillRes <span class="sy1">=</span> killExe<span class="br0">&#40;</span>_Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">szExeName</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="kw1">switch</span> <span class="br0">&#40;</span>iKillRes<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">case</span> ERROR_NOT_FOUND<span class="sy4">:</span></div></li><li class="li1"><div class="de1">						nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>exe not running<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">						<span class="kw1">break</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">case</span> <span class="nu0">0</span><span class="sy4">:</span></div></li><li class="li1"><div class="de1">						nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>exe killed<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">						<span class="kw1">break</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">					<span class="kw1">default</span><span class="sy4">:</span></div></li><li class="li1"><div class="de1">						nclog<span class="br0">&#40;</span>L<span class="st0">&quot;unable to kill exe. GetLastError=%08x<span class="es1">\n</span>&quot;</span>, iKillRes<span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">						<span class="kw1">break</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">				<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">			<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">		<span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">			nclog<span class="br0">&#40;</span>L<span class="st0">&quot;Exec/Kill skipped as this is a delayed schedule<span class="es1">\n</span>&quot;</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">		<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">else</span></div></li><li class="li1"><div class="de1">		nclog<span class="br0">&#40;</span>L<span class="st0">&quot;<span class="es1">\t</span>task %i is inactive (0x%02x)<span class="es1">\n</span>&quot;</span>, iTask, _Tasks<span class="br0">&#91;</span>iTask<span class="br0">&#93;</span>.<span class="me1">iActive</span><span class="br0">&#41;</span><span class="sy4">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">		<span class="kw1">return</span> iReturn<span class="sy4">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<h2> Tasker2 control</h2>
<p>Although you normally dont need to run tasker2 manually, I have added some command line arguments:</p>
<p>&#8220;-c&#8221;    instructs tasker2.exe to remove all tasker2 schedules of the scheduler database<br />
&#8220;-r taskX&#8221;    deactivate processing of task with number X, sets the active flag to 0<br />
&#8220;-a taskX&#8221;    activate processing of task number X, sets the active flag to 1<br />
&#8220;-d&#8221;    dump a list of all active notifications of the windows mobile scheduler</p>
<p>Do not use -s taskX and -k taskX except for testing. The args &#8216;-s taskX&#8217; and &#8216;-k taskX&#8217; are only be used by the scheduler.</p>
<h2>Log file</h2>
<p>The log file will log all activities of tasker2 in the directory of tasker2.exe. It will grow until 1MB and then one log backup file is saved. So you may have two log files, one active and one backup of the previous log.</p>
<div id="wpshdo_17" class="wp-synhighlighter-outer"><div id="wpshdt_17" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_17"></a><a id="wpshat_17" class="wp-synhighlighter-title" href="#codesyntax_17"  onClick="javascript:wpsh_toggleBlock(17)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_17" onClick="javascript:wpsh_code(17)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_17" onClick="javascript:wpsh_print(17)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_17" class="wp-synhighlighter-inner" style="display: block;"><pre class="dos" style="font-family:monospace;"><ol><li class="li1"><div class="de1">0xfacbcab2: ++++++++++++++++ Tasker v300 started +++++++++++++++++++</div></li><li class="li1"><div class="de1">0xfacbcab2: Checking <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> Mutex <span class="br0">&#40;</span>single instance allowed only<span class="br0">&#41;</span>...</div></li><li class="li1"><div class="de1">0xfacbcab2: 	Created new mutex</div></li><li class="li1"><div class="de1">0xfacbcab2: ~~~ using actual localtime:</div></li><li class="li1"><div class="de1">0xfacbcab2: 	 23.12.2011, 12:28</div></li><li class="li1"><div class="de1">0xfacbcab2: CmdLine =</div></li><li class="li1"><div class="de1">0xfacbcab2: Checking <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> valid date/time...</div></li><li class="li1"><div class="de1">0xfacbcab2: Date/Time after 11 2011. OK</div></li><li class="li1"><div class="de1">0xfacbcab2: Clearing Event Notifications...0xfacbcab2: OK</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: ...</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3d00000f</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x33000025</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3800002a</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3b00001b</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3800002e</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3f00001e</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x37000016</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: CeClearUserNotification <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> handle: 0x3a000030</div></li><li class="li1"><div class="de1">0xfacbcab2: ClearRunApp<span class="br0">&#40;</span><span class="br0">&#41;</span>: returns 8</div></li><li class="li1"><div class="de1">0xfacbcab2: Cleared 8 Tasker schedules</div></li><li class="li1"><div class="de1">0xfacbcab2: scheduleAllTasks: ClearAllSchedules <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> 8 tasks</div></li><li class="li1"><div class="de1">0xfacbcab2: Clearing Event Notifications...0xfacbcab2: Clearing Event Notifications...0xfacbcab2: OK</div></li><li class="li1"><div class="de1">0xfacbcab2: Adding Time_Change Event Notification...0xfacbcab2: OK</div></li><li class="li1"><div class="de1">0xfacbcab2: Adding TZ_Change Event Notification...0xfacbcab2: OK</div></li><li class="li1"><div class="de1">0xfacbcab2: Creating new Start Task schedule <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> '\Windows\notes.exe' <a href="http://www.ss64.com/nt/in.html"><span class="kw1">in</span></a> Task1</div></li><li class="li1"><div class="de1">0xfacbcab2: 	calculating new schedule <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> '201112231300'...</div></li><li class="li1"><div class="de1">0xfacbcab2: 	interval is: 0d01h00m</div></li><li class="li1"><div class="de1">0xfacbcab2: 	schedule adjusted to '201112231300'</div></li><li class="li1"><div class="de1">0xfacbcab2: 	ScheduleRunApp: Next run at: 23.12.2011 13:00:56</div></li><li class="li1"><div class="de1">0xfacbcab2: 	ScheduleRunApp: CeSetUserNotificationEx succeeded...</div></li><li class="li1"><div class="de1">0xfacbcab2: Creating new Kill Task schedule <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> '\Windows\notes.exe' <a href="http://www.ss64.com/nt/in.html"><span class="kw1">in</span></a> Task1</div></li><li class="li1"><div class="de1">0xfacbcab2: 	calculating new schedule <a href="http://www.ss64.com/nt/for.html"><span class="kw1">for</span></a> '<span class="nu0">201112231300</span>'...</div></li><li class="li1"><div class="de1">0xfacbcab2: 	interval is: 0d01h00m</div></li><li class="li1"><div class="de1">0xfacbcab2: 	schedule adjusted to '<span class="nu0">201112231300</span>'</div></li><li class="li1"><div class="de1">0xfacbcab2: 	ScheduleRunApp: Next run at: 23.12.2011 <span class="nu0">13</span>:00:<span class="nu0">56</span></div></li><li class="li1"><div class="de1">0xfacbcab2: 	ScheduleRunApp: CeSetUserNotificationEx succeeded...</div></li><li class="li1"><div class="de1">...</div></li></ol></pre></div></div>
<p>The first entry in the log file is the current logging instance. As multiple instances may write randomly at the log, the instance number is needed to idetify which instance has written the current log line.</p>
<h2>Changes</h2>
<p>There are two variants of tasker2, one is using SYSTEMTIME and the other, new one uses time_t. I switched to time_t as it is more easy to do operations like add-one-day with time_t vars than with SYSTEMTIME.</p>
<p>The old variant (v234a) is available as a branch in the code repository: http://code.google.com/p/tasker2/source/browse/#svn%2Fbranch%2Fversion232%2FTasker</p>
<h2>Tests</h2>
<p>Fortunately I had great help by a tester of the software. Many thanks to Thomas B.</p>
<p>I built my only automatic test suite using batch files and a special build of tasker2.exe. If you uncomment the line //#define TESTMODE at the beginning of tasker2.cpp, the compiled app will be in test mode. That means it will not add or remove schedules to/from the windows mobile scheduler. There is another tool used in the test_run.bat that sets the date and time of the device remotely (ActiveSync or Windows Mobile Device Center connection).</p>
<p>The automatic test uses the great tools of itsutils and will set registry values, change date/time, launch tasker2, get the log and build a merged log with all essential data to check the function of tasker2:</p>
<p>http://code.google.com/p/tasker2/source/browse/#svn%2Ftrunk%2FTasker%2Ftest</p>
<p>Here is a snippet from the test_bat.bat:</p>
<div id="wpshdo_18" class="wp-synhighlighter-outer"><div id="wpshdt_18" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_18"></a><a id="wpshat_18" class="wp-synhighlighter-title" href="#codesyntax_18"  onClick="javascript:wpsh_toggleBlock(18)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_18" onClick="javascript:wpsh_code(18)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_18" onClick="javascript:wpsh_print(18)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_18" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="sy0">@</span><span class="kw1">echo</span> off</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="co2">############## START ###############</span></div></li><li class="li1"><div class="de1"><span class="kw1">echo</span>  MAKE SHURE THE RADIOS ARE OFF TO</div></li><li class="li1"><div class="de1"><span class="kw1">echo</span>  AVOID AUTOMATIC <a href="http://www.php.net/time"><span class="kw3">TIME</span></a> SYNCS<span class="sy0">!</span></div></li><li class="li1"><div class="de1"><span class="kw1">echo</span> <span class="sy0">.</span></div></li><li class="li1"><div class="de1">PAUSE Press any <a href="http://www.php.net/key"><span class="kw3">key</span></a> to start</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="co2">############## START ############### &gt;test_run.txt</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">echo</span> Importing test reg keys<span class="sy0">...</span></div></li><li class="li1"><div class="de1"><span class="kw1">echo</span> Importing test reg keys<span class="sy0">...</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">pregutl <span class="sy0">@</span>tasker2<span class="sy0">.</span>reg <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">pdel \tasker2<span class="sy0">.</span>exe<span class="sy0">.</span><a href="http://www.php.net/log"><span class="kw3">log</span></a><span class="sy0">.</span>txt <span class="sy0">&gt;</span>NUL</div></li><li class="li1"><div class="de1">pput <span class="sy0">-</span>f <span class="sy0">./</span>tasker2<span class="sy0">.</span>exe \tasker2<span class="sy0">.</span>exe</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> TEST1<span class="sy0">...</span></div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> 	set <a href="http://www.php.net/time"><span class="kw3">time</span></a> manually to 01<span class="sy0">.</span>01<span class="sy0">.</span>2003 12<span class="sy0">:</span>00</div></li><li class="li1"><div class="de1"><span class="kw1">echo</span> 	run tasker2<span class="sy0">.</span>exe</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">++++++++++++++</span> TEST1 <span class="sy0">++++++++++++++++</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">pregutl HKLM\Software\Tasker  <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">-------------------------------------</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> set <a href="http://www.php.net/time"><span class="kw3">time</span></a> manually to 01<span class="sy0">.</span>01<span class="sy0">.</span>2003 12<span class="sy0">:</span>00 <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">-------------------------------------</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">prun \SetDateTime<span class="sy0">.</span>exe 200301011200</div></li><li class="li1"><div class="de1">CALL <span class="sy0">:</span>MYWAIT</div></li><li class="li1"><div class="de1">prun \tasker2<span class="sy0">.</span>exe</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="st0">&quot;############# Result:&quot;</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">pregutl HKLM\Software\Tasker <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">***************</span> <a href="http://www.php.net/log"><span class="kw3">LOG</span></a>  <span class="sy0">****************</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">pget <span class="sy0">-</span>f \tasker2<span class="sy0">.</span>exe<span class="sy0">.</span><a href="http://www.php.net/log"><span class="kw3">log</span></a><span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">type tasker2<span class="sy0">.</span>exe<span class="sy0">.</span><a href="http://www.php.net/log"><span class="kw3">log</span></a><span class="sy0">.</span>txt <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1">pdel \tasker2<span class="sy0">.</span>exe<span class="sy0">.</span><a href="http://www.php.net/log"><span class="kw3">log</span></a><span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">---------------</span>TEST1  <span class="sy0">---------------</span> <span class="sy0">&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li><li class="li1"><div class="de1"><span class="kw1">ECHO</span> <span class="sy0">.&gt;&gt;</span>test_run<span class="sy0">.</span>txt</div></li></ol></pre></div></div>
<h2>Downloads</h2>
<p>The full tasker2 source code is available at http://code.google.com/p/tasker2/source/browse</p>
<p>Tool to look at the scheduler database [NotificationList]: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=149" title="Downloaded 45 times">NotificationList</a> - A tool to list notifications (Hits: 45, size: 153.42 kB)</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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%2F&amp;title=Windows+Mobile+%26%238211%3B+tasker2+runs+and+stops+applications+periodically" 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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%2F&amp;title=Windows+Mobile+%26%238211%3B+tasker2+runs+and+stops+applications+periodically" 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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%2F&amp;title=Windows+Mobile+%26%238211%3B+tasker2+runs+and+stops+applications+periodically" 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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%2F&amp;T=Windows+Mobile+%26%238211%3B+tasker2+runs+and+stops+applications+periodically" 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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%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%2F2011%2F12%2F23%2Fwindows-mobile-tasker2-runs-and-stops-applications-periodically%2F&amp;t=Windows+Mobile+%26%238211%3B+tasker2+runs+and+stops+applications+periodically" 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/2011/12/23/windows-mobile-tasker2-runs-and-stops-applications-periodically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Mobile &#8211; the no-go world of Function Keys</title>
		<link>http://www.hjgode.de/wp/2011/12/20/windows-mobile-the-no-go-world-of-function-keys/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-mobile-the-no-go-world-of-function-keys</link>
		<comments>http://www.hjgode.de/wp/2011/12/20/windows-mobile-the-no-go-world-of-function-keys/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 09:07:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Windows Mobile Information]]></category>
		<category><![CDATA[AllKeys]]></category>
		<category><![CDATA[Function Key]]></category>
		<category><![CDATA[Internet Explorer Mobile]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[UnregisterFunc1]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1274</guid>
		<description><![CDATA[Hello I want to summarize the role of function keys in Windows Mobile, former Pocket PC, as I got several questions each week on how to use or enable Function keys in this or that application. Here is a simple information about how function keys work in Windows Mobile. As example you have a web [...]]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p><span style="background-color: #c0c0c0;">I want to summarize the role of <span style="color: #ff0000;"><strong>function keys in Windows Mobile</strong></span>, former Pocket PC, as I got several questions each week on how to use or enable Function keys in this or that application.</span></p>
<p><span style="background-color: #c0c0c0;">Here is a simple information about <span style="color: #ff0000;">how function keys work in Windows Mobile</span>.</span></p>
<p><span id="more-1274"></span>As example you have a web application which shows F3 and F4 as shortcuts to previous/next page:</p>
<div id="attachment_1275" class="wp-caption alignnone" style="width: 250px"><a href="http://www.hjgode.de/wp/2011/12/20/windows-mobile-the-no-go-world-of-function-keys/test_not_ok-htm-in_ib_pie/" rel="attachment wp-att-1275"><img class="size-full wp-image-1275" title="SAP ITS Mobile screen Intermec Browser" src="http://www.hjgode.de/wp/wp-content/uploads/2011/12/test_not_ok.htm.in_IB_PIE.gif" alt="SAP ITS Mobile screen Intermec Browser" width="240" height="320" /></a><p class="wp-caption-text">SAP ITS Mobile screen Intermec Browser</p></div>
<p>Without some prepare this screen will not react on function keys! As the screen shows Intermec Browser (IB) with a SAP ITS Mobile form, you are able to define settings in IB to be able to really use the Function Keys.</p>
<p>Windows Mobile uses Function Key values for its own purpose. The usage can be retrieved by looking at winuserm.h of a Windows Mobile SDK:</p>
<div id="wpshdo_19" class="wp-synhighlighter-outer"><div id="wpshdt_19" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_19"></a><a id="wpshat_19" class="wp-synhighlighter-title" href="#codesyntax_19"  onClick="javascript:wpsh_toggleBlock(19)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_19" onClick="javascript:wpsh_code(19)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_19" onClick="javascript:wpsh_print(19)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_19" class="wp-synhighlighter-inner" style="display: block;"><pre class="cpp" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="co1">//winuserm.h</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TSOFT1   VK_F1               // Softkey 1</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TSOFT2   VK_F2               // Softkey 2</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TTALK    VK_F3               // Talk</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TEND     VK_F4               // End</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TRECORD      VK_F10          // Record</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TFLIP        VK_F17          // Flip</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TPOWER       VK_F18          // Power</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TVOLUMEUP    VK_F6           // Volume Up</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TVOLUMEDOWN  VK_F7           // Volume Down</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TSPEAKERPHONE_TOGGLE VK_F16</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_END_ALL_DATA_CALLS   VK_F15</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TSTAR    VK_F8               // *</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_TPOUND   VK_F9               // #</span></div></li><li class="li1"><div class="de1">...</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_SYMBOL   VK_F11              // Symbol (SYM) key</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_REDKEY   VK_F19              // Sent by a keypad that has a special red function key</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_ROCKER   VK_F20              // Arrow keys came from a Rocker</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_DPAD     VK_F21              // Arrow keys came from a DPAD</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_ACTION   VK_F23              // Sent with VK_RETURN when doing Action on PPC rockers</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_VOICEDIAL  VK_F24            // Key used to kick off voice dial recognition</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_KEYLOCK    VK_F22            // Key used to lock the device</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_KEYUNLOCK  VK_F25             // Key used to unlock the key lock</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="co1">// Chorded keys.  DONE is VK_RWIN + VK_F6 and MOJI is VK_RWIN + VK_F7</span></div></li><li class="li1"><div class="de1"><span class="co2">#define VK_DONE     VK_F6                 // &lt;OK/Close&gt; hotkey code</span></div></li><li class="li1"><div class="de1"><span class="co2">#define MOD_DONE    (MOD_WIN | MOD_KEYUP) // &lt;OK/Close&gt; hotkey modifiers</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="co2">#define VK_MOJI     VK_F7                  // Key used to switch between FE language layouts</span></div></li><li class="li1"><div class="de1"><span class="co2">#define MOD_MOJI    (MOD_WIN | MOD_KEYUP)  //Modifiers so MOJI goes to the shell</span></div></li><li class="li1"><div class="de1">...</div></li></ol></pre></div></div>
<p>You see that many FunctionKey values are assigned to OS specific functions like Phone, END, Volume Up/Down etc.</p>
<p>So, you can normally not use Function Keys in your application to provide shortcuts to function calls. This is also true for client applications like Terminal Emulators (TE) like NaurTechTE and Intermec TE (ITE), browser based applications like Internet Explorer Mobile or Intermec Kiosk Mode Browser (IB), thin clients like Java client apps (ie. SAP ITS Mobile) or Remote Desktop client apps (ie Remote Desktop Mobile, zaDesktop).</p>
<p>Some of the kiosk mode apps provide a way to enable you to use Function Keys (see example at top). They can do so, as they use API calls like UnregisterFunc1 or AllKeys(TRUE) or GXOpenInput (deprecated!). These APIs instruct Windows Mobile OS to NOT catch and use Function Keys but handle them like &#8216;normal&#8217; keys.</p>
<p>If you are the coder of an application using CPP, CSharp (C#), VB.NET, CPP or JAVA, you can use the Microsoft API function AllKeys(TRUE) in your code and Windows Mobile will not tamper the function keys.</p>
<p>If you are not the coder you may use UnregisterFunc1 (see my post &#8220;<a title="Free up your function keys" href="http://www.hjgode.de/wp/2010/02/10/use-funckey-to-free-up-your-functionkeys-on-windows-mobile/">Freedom for Function Keys</a>&#8220;). But be warned, there are applications that even then will not process Function Keys or do not forward them. For example Internet Explorer Mobile (IEM) will NOT process Function Keys except for internal functions like help or full-screen. Another bad example is Remote Desktop Mobile (RDM). It does not support Function Keys, even if you un-register them before you launch RDM, Function Keys will NOT be processed or transmitted to the host application. An alternative to RDM with function key support is <a href="http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/">rdesktopCE</a>.</p>
<p>When you use UnregisterFunc1, you can check the Function Keys using a tool like <a title="Keytest3AK" href="http://www.hjgode.de/wp/2009/05/11/keytest3ak-a-tool-to-look-at-keyboard-codes/">KeyTest3AK</a>. It will show the keydown and keyup values of keys and shows what happens if you use AllKeys():</p>
<p><a href="http://www.hjgode.de/wp/2009/05/11/keytest3ak-a-tool-to-look-at-keyboard-codes/screenshot_keytest3ak/" rel="attachment wp-att-615"><img class="alignnone size-full wp-image-615" title="screenshot_keytest3ak" src="http://www.hjgode.de/wp/wp-content/uploads/2009/05/screenshot_keytest3ak.gif" alt="" width="240" height="320" /></a></p>
<p><a href="http://www.hjgode.de/wp/?s=allkeys">More posts about AllKeys</a></p>
<p><strong>Update 1. march 2012:</strong></p>
<p>Additional annoyance: Did youknow, that <strong>F11</strong> will be signaled as<br />
<strong>WM_KEYDOWN VK_PROCESSKEY</strong><br />
<strong>WM_KEYUP VK_F11</strong><br />
so you can only rely on the keyup message for this function key. The translation of WM_KEYDOWN VK_F11 is done by the OS and cant be disabled, AFAIK.</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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%2F&amp;title=Windows+Mobile+%26%238211%3B+the+no-go+world+of+Function+Keys" 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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%2F&amp;title=Windows+Mobile+%26%238211%3B+the+no-go+world+of+Function+Keys" 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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%2F&amp;title=Windows+Mobile+%26%238211%3B+the+no-go+world+of+Function+Keys" 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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%2F&amp;T=Windows+Mobile+%26%238211%3B+the+no-go+world+of+Function+Keys" 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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%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%2F2011%2F12%2F20%2Fwindows-mobile-the-no-go-world-of-function-keys%2F&amp;t=Windows+Mobile+%26%238211%3B+the+no-go+world+of+Function+Keys" 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/2011/12/20/windows-mobile-the-no-go-world-of-function-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opencart vqmod &#8211; Telefonnummer bei Registrierung nicht erforderlich</title>
		<link>http://www.hjgode.de/wp/2011/12/15/opencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=opencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich</link>
		<comments>http://www.hjgode.de/wp/2011/12/15/opencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 19:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[OpenCart]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[abmahnung]]></category>
		<category><![CDATA[opencart]]></category>
		<category><![CDATA[registrierung]]></category>
		<category><![CDATA[telefonnummer]]></category>
		<category><![CDATA[vqmod]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1270</guid>
		<description><![CDATA[Anbei ein kleines vqmod file für Opencart 1.5.1.3 (englische und deutsche Sprachdateien) welches die Telefonnumer bei Registrierung als Kunde nicht zwingend erforderlich kennzeichnet. Normalerweise muß ein Neu-Kunde seine Telefonnummer bei der Registrierung angeben. Dies wird durch dieses vqmod file geändert und der Kunde muß keine Telefonnumer angeben, wenn er sich registriert. Das vqmod file einfach [...]]]></description>
			<content:encoded><![CDATA[<p>Anbei ein kleines vqmod file für Opencart 1.5.1.3 (englische und deutsche Sprachdateien) welches die Telefonnumer bei Registrierung als Kunde nicht zwingend erforderlich kennzeichnet.</p>
<p>Normalerweise muß ein Neu-Kunde seine Telefonnummer bei der Registrierung angeben. Dies wird durch dieses vqmod file geändert und der Kunde muß keine Telefonnumer angeben, wenn er sich registriert. Das vqmod file einfach in das Opencart vqmod/xml Verzeichnis kopieren. Wenn was nicht funktioniert, die Datei einfach wieder löschen.</p>
<p><span id="more-1270"></span></p>
<pre></pre>
<div id="wpshdo_20" class="wp-synhighlighter-outer"><div id="wpshdt_20" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_20"></a><a id="wpshat_20" class="wp-synhighlighter-title" href="#codesyntax_20"  onClick="javascript:wpsh_toggleBlock(20)" title="Click to show/hide code block">vqmod_tel_not_required.xml</a></td><td align="right"><a href="#codesyntax_20" onClick="javascript:wpsh_code(20)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_20" onClick="javascript:wpsh_print(20)" title="Print code"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.hjgode.de/wp/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_20" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="sy1">&lt;?</span>xml version<span class="sy0">=</span><span class="st0">&quot;1.0&quot;</span> encoding<span class="sy0">=</span><span class="st0">&quot;UTF-8&quot;</span><span class="sy1">?&gt;</span></div></li><li class="li1"><div class="de1">&lt;modification&gt;</div></li><li class="li1"><div class="de1">        &lt;id&gt;Do NOT require phone-number as required input&lt;/id&gt;</div></li><li class="li1"><div class="de1">        &lt;version&gt;1.0.0&lt;/version&gt;</div></li><li class="li1"><div class="de1">        &lt;vqmver&gt;1.0.9&lt;/vqmver&gt;</div></li><li class="li1"><div class="de1">        &lt;author&gt;hjgode&lt;/author&gt;</div></li><li class="li1"><div class="de1">		&lt;!-- changes for opencart 1.5.1.3 --&gt;</div></li><li class="li1"><div class="de1">        &lt;file name=&quot;catalog/view/theme/*/template/account/register.tpl&quot;&gt;</div></li><li class="li1"><div class="de1">                &lt;operation&gt;</div></li><li class="li1"><div class="de1">                    &lt;search position=&quot;replace&quot;&gt;</div></li><li class="li1"><div class="de1">                         &lt;![CDATA[&lt;td&gt;&lt;span class=&quot;required&quot;&gt;*&lt;/span&gt; <span class="kw2">&lt;?php</span> <span class="kw1">echo</span> <span class="re0">$entry_telephone</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&lt;/td&gt;]]&gt;</div></li><li class="li1"><div class="de1">                    &lt;/search&gt;</div></li><li class="li1"><div class="de1">                    &lt;add&gt;</div></li><li class="li1"><div class="de1">                          &lt;![CDATA[&lt;td&gt;<span class="kw2">&lt;?php</span> <span class="kw1">echo</span> <span class="re0">$entry_telephone</span><span class="sy0">;</span> <span class="sy1">?&gt;</span>&lt;/td&gt;]]&gt;</div></li><li class="li1"><div class="de1">                    &lt;/add&gt;</div></li><li class="li1"><div class="de1">                &lt;/operation&gt;</div></li><li class="li1"><div class="de1">        &lt;/file&gt;</div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        &lt;file name=&quot;catalog/controller/account/register.php&quot;&gt;</div></li><li class="li1"><div class="de1">                &lt;operation&gt;</div></li><li class="li1"><div class="de1">                    &lt;search position=&quot;replace&quot;&gt;</div></li><li class="li1"><div class="de1">                         &lt;![CDATA[if ((utf8_strlen($this-&gt;request-&gt;post['telephone']) &lt; 3) || (utf8_strlen($this-&gt;request-&gt;post['telephone']) &gt; 32)) {]]&gt;</div></li><li class="li1"><div class="de1">                    &lt;/search&gt;</div></li><li class="li1"><div class="de1">                    &lt;add&gt;</div></li><li class="li1"><div class="de1">                          &lt;![CDATA[if ((utf8_strlen($this-&gt;request-&gt;post['telephone']) &lt; 0) || (utf8_strlen($this-&gt;request-&gt;post['telephone']) &gt; 32)) {]]&gt;</div></li><li class="li1"><div class="de1">                    &lt;/add&gt;</div></li><li class="li1"><div class="de1">                &lt;/operation&gt;</div></li><li class="li1"><div class="de1">        &lt;/file&gt;</div></li><li class="li1"><div class="de1">&lt;/modification&gt;</div></li></ol></pre></div></div>
<p>Have Fun</p>
<p>Josef</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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%2F&amp;title=Opencart+vqmod+%26%238211%3B+Telefonnummer+bei+Registrierung+nicht+erforderlich" 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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%2F&amp;title=Opencart+vqmod+%26%238211%3B+Telefonnummer+bei+Registrierung+nicht+erforderlich" 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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%2F&amp;title=Opencart+vqmod+%26%238211%3B+Telefonnummer+bei+Registrierung+nicht+erforderlich" 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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%2F&amp;T=Opencart+vqmod+%26%238211%3B+Telefonnummer+bei+Registrierung+nicht+erforderlich" 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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%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%2F2011%2F12%2F15%2Fopencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich%2F&amp;t=Opencart+vqmod+%26%238211%3B+Telefonnummer+bei+Registrierung+nicht+erforderlich" 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/2011/12/15/opencart-vqmod-telefonnummer-bei-registrierung-nicht-erforderlich/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

