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

<channel>
	<title>Windows CE Programming &#187; Programming</title>
	<atom:link href="http://www.hjgode.de/wp/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hjgode.de/wp</link>
	<description>Windows Mobile Development and usage</description>
	<lastBuildDate>Fri, 03 Feb 2012 08:53:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<!--CodeProjectFeeder channel--><category>CodeProject</category><generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>All you need to know about unicode</title>
		<link>http://www.hjgode.de/wp/2011/03/18/all-you-need-to-know-about-unicode/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=all-you-need-to-know-about-unicode</link>
		<comments>http://www.hjgode.de/wp/2011/03/18/all-you-need-to-know-about-unicode/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 15:55:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[multibyte]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf]]></category>
		<category><![CDATA[utf-16]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[widebyte]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1085</guid>
		<description><![CDATA[Recently I stumbled about this great article about ASCII, 7 and 8 Bit, codepages, Multi byte, Wide byte and unicode: http://www.joelonsoftware.com/articles/Unicode.html If you ever get in trouble with wrong encoding display of chars, give this article a try to know the backgrounds. As you know, Windows CE and Windows Mobile  is always unicode except for [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I stumbled about this great article about ASCII, 7 and 8 Bit, codepages, Multi byte, Wide byte and unicode: http://www.joelonsoftware.com/articles/Unicode.html</p>
<p>If you ever get in trouble with wrong encoding display of chars, give this article a try to know the backgrounds.</p>
<p>As you know, Windows CE and Windows Mobile  is always unicode except for serial and socket communication. But the truetype fonts available on Windows Mobile devices mostly support only common chars, there file size is about 600K. The file size of Arial Unicode MS is about 22MB.</p>
<p>regards</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%2F03%2F18%2Fall-you-need-to-know-about-unicode%2F&amp;title=All+you+need+to+know+about+unicode" 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%2F03%2F18%2Fall-you-need-to-know-about-unicode%2F&amp;title=All+you+need+to+know+about+unicode" 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%2F03%2F18%2Fall-you-need-to-know-about-unicode%2F&amp;title=All+you+need+to+know+about+unicode" 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%2F03%2F18%2Fall-you-need-to-know-about-unicode%2F&amp;T=All+you+need+to+know+about+unicode" 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%2F03%2F18%2Fall-you-need-to-know-about-unicode%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%2F03%2F18%2Fall-you-need-to-know-about-unicode%2F&amp;t=All+you+need+to+know+about+unicode" 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/03/18/all-you-need-to-know-about-unicode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development &#8211; Simple serial communication application</title>
		<link>http://www.hjgode.de/wp/2011/03/10/mobile-development-simple-serial-communication-application/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-simple-serial-communication-application</link>
		<comments>http://www.hjgode.de/wp/2011/03/10/mobile-development-simple-serial-communication-application/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 14:31:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[SerialPort]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1072</guid>
		<description><![CDATA[Here is a simple application to connect to a serial port. The idea is based on the need of having an application to send demo print files to a virtual comm port connected to a bluetooth printer. Update 16. March 2011: Added dialog to connect to BT printer by BT Address on Intermec devices. New [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple application to connect to a serial port. The idea is based on the need of having an application to send demo print files to a virtual comm port connected to a bluetooth printer.</p>
<p><strong>Update 16. March 2011:</strong> Added dialog to connect to BT printer by BT Address on Intermec devices. New source and binary at code.google.com.</p>
<p><strong>Update 21. March 2011:</strong> Splitted source code and providing three different flavours:<br />
CommAppCFSerial does serial comm only.<br />
CommAppCFbtSearch provides BT connect (Intermec Devices only) and BT discovery<br />
CommAppCF itself is a unstable working release<br />
see code.google.com/p/win-mobile-code &#8230; Executables are in bin subdirs.</p>
<p>You can enter and send texts to or send a whole file to the port. Additionally you are able to send ASCII codes by using \xAB syntax, where AB is the hex code of the byte you would like to send.</p>
<p>There is nothing special with the code except the hex decoding/encoding and the possibility to send a file.</p>
<p><a rel="attachment wp-att-1073" href="http://www.hjgode.de/wp/2011/03/10/mobile-development-simple-serial-communication-application/commappcf/"><img class="alignnone size-medium wp-image-1073" title="CommAppCF" src="http://www.hjgode.de/wp/wp-content/uploads/2011/03/CommAppCF-225x300.png" alt="" width="225" height="300" /></a> <a rel="attachment wp-att-1074" href="http://www.hjgode.de/wp/2011/03/10/mobile-development-simple-serial-communication-application/commappcf_connect/"><img class="alignnone size-medium wp-image-1074" title="CommAppCF_connect" src="http://www.hjgode.de/wp/wp-content/uploads/2011/03/CommAppCF_connect-225x300.png" alt="" width="225" height="300" /></a> <a rel="attachment wp-att-1075" href="http://www.hjgode.de/wp/2011/03/10/mobile-development-simple-serial-communication-application/commappcf_sendstatus/"><img class="alignnone size-medium wp-image-1075" title="CommAppCF_sendstatus" src="http://www.hjgode.de/wp/wp-content/uploads/2011/03/CommAppCF_sendstatus-225x300.png" alt="" width="225" height="300" /></a></p>
<p><span id="more-1072"></span>Here is a short sample how the SendFile is implemented:</p>
<pre lang="csharp">        private void sendFile(string filename)
        {
            try
            {
                updateTxtRcv("Starting sendFile(" + filename + ")");

                System.IO.StreamReader sr = new System.IO.StreamReader(filename);
                int r;
                int blockSize = 4096;
                char[] buf = new char[blockSize];
                //how many blocks to send?
                System.IO.FileInfo fi = new System.IO.FileInfo(filename);
                long lBlocks = (long)(fi.Length / blockSize);
                if (lBlocks == 0)
                    lBlocks = 1;
                updateTxtRcv("Need to send " + lBlocks.ToString() + " blocks...");
                long lBlockNr = 1;
                do
                {
                    updateTxtRcv("Sending block " + lBlockNr.ToString() + " ...");
                    r = sr.Read(buf, 0, blockSize); //r = number of bytes read
                    comport.Write(buf, 0, r);
                }
                while (r!=-1 &amp;&amp; !sr.EndOfStream);
                sr.Close();
                updateTxtRcv("Finished sendFile(" + filename + ")");
            }
            catch (Exception x)
            {
                updateTxtRcv("sendFile exception:" + x.Message);
                System.Diagnostics.Debug.WriteLine(x.Message);
            }
        }</pre>
<p>The application persists choosen settings in the registry. I had to implement classes to convert SerialPort Parity, Handshake, Stopbits etc settings between typed and integer values. Unfortunately the enums for these properties are not defined on base of integer. For example I had to code this class to enable save/restore of the Handshake property:</p>
<pre lang="csharp">    public static class myHandshake
    {
        public static string[] handshakes = { "None", "XOnXOff", "RequestToSend", "RequestToSendXOnXOff" };
        public static Handshake ToHandshake(int i)
        {
            switch (i)
            {
                case 0: return Handshake.None;
                case 1: return Handshake.XOnXOff;
                case 2: return Handshake.RequestToSend;
                case 3: return Handshake.RequestToSendXOnXOff;
            }
            return Handshake.None;
        }
        public static Handshake ToHandshake(string text)
        {
            if (text.Equals("None", StringComparison.OrdinalIgnoreCase))
                return Handshake.None;
            if (text.Equals("XOnXOff", StringComparison.OrdinalIgnoreCase))
                return Handshake.XOnXOff;
            if (text.Equals("RequestToSend", StringComparison.OrdinalIgnoreCase))
                return Handshake.RequestToSend;
            if (text.Equals("RequestToSendXOnXOff", StringComparison.OrdinalIgnoreCase))
                return Handshake.RequestToSendXOnXOff;
            return Handshake.None;
        }
        public static int ToInt(Handshake hs)
        {
            switch (hs)
            {
                case Handshake.None: return 0;
                case Handshake.XOnXOff: return 1;
                case Handshake.RequestToSend: return 2;
                case Handshake.RequestToSendXOnXOff: return 3;
            }
            return 0;
        }
        public static string ToString(Handshake hs)
        {
            switch (hs)
            {
                case Handshake.None: return "None";
                case Handshake.XOnXOff: return "XOnXOff";
                case Handshake.RequestToSend: return "RequestToSend";
                case Handshake.RequestToSendXOnXOff: return "RequestToSendXOnXOff";
            }
            return "None";
        }
        public static string ToString(int i)
        {
            switch (i)
            {
                case 0: return "None";
                case 1: return "XOnXOff";
                case 2: return "RequestToSend";
                case 3: return "RequestToSendXOnXOff";
            }
            return "None";
        }
    }//class myHandshake</pre>
<p>This would have been a lot easier if the Handshake enum was based on integer.</p>
<p>BTW using StopBits.None is not supported: &#8220;This value is not supported. Setting the System.IO.Ports.SerialPort.StopBits property to System.IO.Ports.StopBits.None raises an System.ArgumentOutOfRangeException.&#8221; (see StopBits enumeration).</p>
<p>Source code and binary located at <a href="http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk%2FCommAppCF" target="_blank">code.google.com</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2011%2F03%2F10%2Fmobile-development-simple-serial-communication-application%2F&amp;title=Mobile+Development+%26%238211%3B+Simple+serial+communication+application" 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%2F03%2F10%2Fmobile-development-simple-serial-communication-application%2F&amp;title=Mobile+Development+%26%238211%3B+Simple+serial+communication+application" 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%2F03%2F10%2Fmobile-development-simple-serial-communication-application%2F&amp;title=Mobile+Development+%26%238211%3B+Simple+serial+communication+application" 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%2F03%2F10%2Fmobile-development-simple-serial-communication-application%2F&amp;T=Mobile+Development+%26%238211%3B+Simple+serial+communication+application" 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%2F03%2F10%2Fmobile-development-simple-serial-communication-application%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%2F03%2F10%2Fmobile-development-simple-serial-communication-application%2F&amp;t=Mobile+Development+%26%238211%3B+Simple+serial+communication+application" 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/03/10/mobile-development-simple-serial-communication-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development &#8211; subclassing the Camera View (CameraCaptureDialog, SHCameraCapture)</title>
		<link>http://www.hjgode.de/wp/2011/03/08/mobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture</link>
		<comments>http://www.hjgode.de/wp/2011/03/08/mobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 14:21:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[hook.wndproc]]></category>
		<category><![CDATA[Subclassing]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1065</guid>
		<description><![CDATA[If you are running a kiosk mode app but need to provide the camercapture dialog on Windows Mobile 5 or later, you may need to disable the one or other click in the CameraCapture dialog. This article uses a technique known as subclassing as already used and decribed in my StartButtonHookWM65 article. For the CameraCapture [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running a kiosk mode app but need to provide the camercapture dialog on Windows Mobile 5 or later, you may need to disable the one or other click in the CameraCapture dialog.</p>
<p>This article uses a technique known as subclassing as already used and decribed in my StartButtonHookWM65 article. For the CameraCapture dialog the code has been revised and you can now subclass any known window class and disable clicks within the Windows Mobile menu bar.</p>
<pre lang="csharp">        private string _winClassName = "HHTaskbar";
        public string winClassName
        {
            get { return _winClassName; }
            set {
                if (this.oldWndProc == IntPtr.Zero) //only allow change before subclassing
                    _winClassName = value;
            }
        }
...
        /// &lt;summary&gt;
        /// SubClassing: Install the wndproc hook
        /// &lt;/summary&gt;
        /// &lt;returns&gt;&lt;/returns&gt;
        private bool hookWindow()
        {
            //find the window to hook
            IntPtr hWndHooked = FindWindow(_winClassName, IntPtr.Zero);
            if (hWndHooked == IntPtr.Zero)
                return false;
            //enable the taskbar, not realy necessary
            EnableWindow(hWndHooked, true);
            //already installed?
            if (oldWndProc == IntPtr.Zero)
            {
                //find the menu_worker window
                IntPtr hwndMenu_Worker = FindWindow("menu_worker", IntPtr.Zero);
                if (hwndMenu_Worker != IntPtr.Zero)
                {
                    //get the child window which has the buttons on it
                    IntPtr hwndToolbar = GetWindow(hwndMenu_Worker, GetWindow_Cmd.GW_CHILD);
                    if (hwndToolbar != IntPtr.Zero)
                    {
                        _mHwnd = hwndToolbar;       //store to remember
                        SubclassHWnd(hwndToolbar);  //subclass the wndproc
                    }
                }
            }
            return true;
        }
</pre>
<p>As the call to CameraCaptureDialog will block and you can not subclass it before it is launched, I use a timer that will subclass the dialog assuming it will show after the call to .ShowDialog().</p>
<pre lang="csharp">        private System.Windows.Forms.Timer timer;
        hwndutils subClassUtils;
        private void ShowCamera()
        {
            CameraCaptureDialog cdlg = new CameraCaptureDialog();
            cdlg.DefaultFileName="picture.jpg";
            cdlg.InitialDirectory = "\\My Documents";
            cdlg.Mode = CameraCaptureMode.Still;
            cdlg.Owner = this.pictureBox1;
            cdlg.StillQuality = CameraCaptureStillQuality.High;
            cdlg.Title = "Take a picture and Select";
            cdlg.Resolution = new Size(240, 320);
            cdlg.VideoTypes = CameraCaptureVideoTypes.All;

            //subclass main window with delay
            subClassUtils = new hwndutils();
            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;

            DialogResult dRes = <strong>cdlg.ShowDialog();</strong>
...
        void timer_Tick(object sender, EventArgs e)
        {
            subClassUtils.winClassName = "Camera View";
            <strong>subClassUtils.CloseButtonDisabled = true;</strong>
            System.Threading.Thread.Sleep(500);
            if(subClassUtils.CloseButtonDisabled)
                timer.Enabled = false;

        }
</pre>
<p>In the line &#8220;<strong>subClassUtils.CloseButtonDisabled = true;&#8221; </strong>the subclassing (or the hook) will be activated and clicks on (OK) will not be accepted.<strong></strong></p>
<p><a rel="attachment wp-att-1068" href="http://www.hjgode.de/wp/2011/03/08/mobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture/cameracapturedlg/"><img class="alignnone size-medium wp-image-1068" title="CameraCaptureDlg" src="http://www.hjgode.de/wp/wp-content/uploads/2011/03/CameraCaptureDlg-225x300.png" alt="" width="225" height="300" /></a></p>
<p>Code subclassing.cs download: <strong><b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=134" title="Downloaded 156 times">subclassing.cs</a> - subclassing code for C# compact framework (Hits: 156, size: 2.4 kB)<br />
</strong></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%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%2F&amp;title=Mobile+Development+%26%238211%3B+subclassing+the+Camera+View+%28CameraCaptureDialog%2C+SHCameraCapture%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%2F2011%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%2F&amp;title=Mobile+Development+%26%238211%3B+subclassing+the+Camera+View+%28CameraCaptureDialog%2C+SHCameraCapture%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%2F2011%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%2F&amp;title=Mobile+Development+%26%238211%3B+subclassing+the+Camera+View+%28CameraCaptureDialog%2C+SHCameraCapture%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%2F2011%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%2F&amp;T=Mobile+Development+%26%238211%3B+subclassing+the+Camera+View+%28CameraCaptureDialog%2C+SHCameraCapture%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%2F2011%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%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%2F03%2F08%2Fmobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture%2F&amp;t=Mobile+Development+%26%238211%3B+subclassing+the+Camera+View+%28CameraCaptureDialog%2C+SHCameraCapture%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/2011/03/08/mobile-development-subclassing-the-camera-view-cameracapturedialog-shcameracapture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development &#8211; Shake that thing</title>
		<link>http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-shake-that-thing</link>
		<comments>http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 15:52:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[Background Thread]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[g-sensor]]></category>
		<category><![CDATA[Intermec]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[Smart Device]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=921</guid>
		<description><![CDATA[Talking with G-sensors and vector algebra. Shake and Orientation detection.]]></description>
			<content:encoded><![CDATA[<p>Hello Readers</p>
<p>it has been a long time since my last post, I was a little bit busy.</p>
<p>This time I want to present some <strong><em>experimental</em></strong> code to visualize and analyze G-Sensor data. The goal was to achieve a shake detection algorithm. Unfortunately the device under test only provided 1 sample per second and that is not enough for a good shake detection. Beside that the code and classes developed may help you to find your way and they help you at last to determine the current orientation of the device.</p>
<p>left shows general information taken from vector, right shows a log with last vector data<br />
 <a rel="attachment wp-att-922" href="http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/sensorscan5_0102/"><img class="alignnone size-medium wp-image-922" title="SensorScan5_0102" src="http://www.hjgode.de/wp/wp-content/uploads/2011/02/SensorScan5_0102-300x199.gif" alt="" width="300" height="199" /></a><br />
 [image SensorScan5_0102.gif]</p>
<p><a rel="attachment wp-att-924" href="http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/sensorscan5_0304/"><img class="alignnone size-medium wp-image-924" title="SensorScan5_0304" src="http://www.hjgode.de/wp/wp-content/uploads/2011/02/SensorScan5_0304-300x199.gif" alt="" width="300" height="199" /></a><br />
 [image SensorScan5_0304.gif]<br />
 left shows graphical of vector and force (length), right shows indicators for detected events</p>
<p>A g-sensor or accelerometer sensor normally gives you the x, y and z-values of a vector. A vector is an imaginary arrow with a direction and length starting from the three dimensional point 0,0,0. The vector direction points to the acceleration of the device. The normal acceleration on earth is 9,81m/s^2. If the device is on the desk, the y-acceleration is about minus 9.81m/s^2. The absolute value of the sensor may vary on the sensor and maybe defined as 1.0 for -9.81m/s^2 or -0.981. If you through the device up to the air, the x,y and z-values will reach 0,0,0 as if the device is weightless. Keep in mind that the acceleration towards the middle of the earth is always there and the device will come back to you.</p>
<p>Here is another visualization of the vector and a device (done with visual python, <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=130" title="Downloaded 173 times">vectors.py</a> -  (Hits: 173, size: 570 bytes)):</p>
<p><a rel="attachment wp-att-925" href="http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/vectors/"><img class="alignnone size-medium wp-image-925" title="vectors" src="http://www.hjgode.de/wp/wp-content/uploads/2011/02/vectors-286x300.gif" alt="" width="286" height="300" /></a><br />
 [image vectors.gif]</p>
<p>The device is facing upwards (see y arrow) with the top facing to you (the z arrow). The left side of the device is pointing to the right (the x arrow).</p>
<p>The light green/blue and the yellow arrows demonstrate two different vectors which show the direction (the xyz angles) and the force (the vector lengths) to the device.</p>
<p><span id="more-921"></span>and here is an image about how the vector and the device is aligned:</p>
<pre>#region CN50 XYZ vectors
/*
              (N)
              +Y
               |           -Z
               |          /
               |         /
               |       .'
         +-----------+/
         | +-------+ |
         | |       | |
         | |       | |
         | |       | |
(E)''''''| |  /    | |''''''  (W)
+X       | |.'     | |     -X
         | /-------+ |
         |/          |
        .'           |
       / +-----------+
     .'        |
    /          |
  +Z           |
              -Y
              (S)

    //calc the acceleration or the longest vector
    double accel = Math.Sqrt(x * x + y * y + z * z);
    //calc the X angle, should be about 180 if device is upright
    double degrees = Math.Acos(x / b) * 360.0 / Math.PI;

 * when device is faceup on table:          x=0     y=0     z=1
 * when device is faceup on table:          x=0     y=0     z=-1
 * when device is upright scan to roof:     x=0     y=-1    z=0
 * when device is upright scanner to down:  x=0     y=1     z=0
 * when scanner lays on left side:          x=-1    y=0     z=0
 * when scanner lays on right side:         x=1     y=0     z=0
*/
</pre>
<p>The development device was an Int*rm*c CN50. To be able to get the sensor data into a .NET app, first install the sensor wrapper DLLs (sensor.cab) of the Int*rm*c Device Resource Kit. For other devices you just have to change the code that is used to register for sensor data changes.</p>
<pre lang="csharp">		mySensor.AccelerationEvent += new AccelerationEventHandler(mySensor_AccelerationEvent);
...
        void mySensor_AccelerationEvent(object sender, Sensor.AccelerationArgs AccelerationArgs)
        {
            ShakeDetection.GVector gv = new ShakeDetection.GVector(AccelerationArgs.GForceX,
                AccelerationArgs.GForceY,
                AccelerationArgs.GForceZ);

            processData(gv);
        }
</pre>
<p>The class GVector implements some analysis on the vector data. The vector data is built of three acceleration values, the X, Y, and Z part of the acceleration. If the device is layed on a desk, the Z vector is about -9.81 m/s and the X and Y vector will be at 0.0 m/s. If you move the device or turn it, the xyz values will change and you can calculate an orientation and if you collect and evaluate the data over time, you can get the acceleration of the device. If it is falling, the xyz values will all be zero.</p>
<p>The processData() call updates the GUI and feeds the vector data to the shake and movement detection classes:</p>
<pre lang="csharp" escaped="true">        private void processData(ShakeDetection.GVector gv)
        {
            if (starting)
                return;
            labelGFX.Text = gv.X.ToString("0.00000");
            labelGFY.Text = gv.Y.ToString("0.00000");
            labelGFZ.Text = gv.Z.ToString("0.00000");

            lblOrientation.Text = gv.ToScreenOrientation().ToString();
            lblDirection.Text = gv.direction.ToString();

            lblTilt.Text = gv.Tilt.ToString("0");
            lblRoll.Text = gv.Roll.ToString("0");
            lblPitch.Text = gv.Pitch.ToString("0");

            lblAcceleration.Text = gv.Length.ToString("0.0");

            addLog(gv.ToString());

            shaker1.addValues(gv);

            shaker2.addValues(gv);
...
</pre>
<p>The movement classes use an extended version of the GVector class called GMVector. The movement classes are implemented with the basic GMVector interface:</p>
<pre lang="csharp" escaped="true">namespace Movedetection
{
        public struct GMVector
        {
            public GMVector(double x, double y, double z)
            {
                myX = x;
                myY = y;
                myZ = z;
                myTicks = (ulong)(DateTime.Now.Ticks / 10000); //there are 10000 ticks in a millisecond
                // http://msdn.microsoft.com/en-us/library/system.datetime.ticks.aspx

                myDirection = GetDirection(myX, myY, myZ);
                myScreenOrientation = GetScreenorientation(myX, myY, myZ);
                moveState = MoveState.idle;
            }
...
</pre>
<p>The idea was to implement a movement analysis and compare the movement of the device with a given pattern. For example if the last movement sequence matches the given pattern UP-LEFT-DOWN an event will be generated. BUT this is not yet implemented!</p>
<p>The shake and movement classes are all derived from a base class that defines a common interface:</p>
<pre lang="csharp" escaped="true">using System;

namespace ShakeDetection
{
	public interface IShake
	{
        		void OnShakeDetected(GVector gv);
		void addValues(GVector gv);
	}

}
</pre>
<p>Inside the derived classes the vector data is processed and the shake or movement &#8216;calculation&#8217; is implemented. All shake classes are derived from a basic class called &#8220;ShakeClass&#8221; (or &#8220;Movement&#8221; class):</p>
<pre lang="csharp" escaped="true">namespace ShakeDetection
{
    ///

    /// Main abstract class to implement various Shake detector classes
    /// 

	public abstract class ShakeClass:IShake,IDisposable
    {
        #region Properties
        private string _name = "ShakeClass";
        ///
<summary>
        /// used to identify multiple classes that inherited this class
        /// 

		public string name{
            get{return _name;}
            set { _name = value; }
        }
...
</pre>
<p>One analysis done by GVector class itself is the segmented direction, which shows in which direction the top of the device is pointing expressed in compass like directions.</p>
<pre lang="csharp" escaped="true">		#region segmented direction
			// http://en.wikipedia.org/wiki/Boxing_the_compass" href="http://en.wikipedia.org/wiki/Boxing_the_compass"
            //attention: this here is based on +Y/+X (-1/0) equal 0 degree equal North
			public enum Direction:int{
                None=-1,
			W=0,
				WSW,
				SW,
				SSW,
			S,
				SSE,
				SE,
				ESE,
			E,
				ENE,
				NE,
				NNE,
			N,
				NNW,
				NW,
				WNW,
			}
            public Direction direction
            { // http://stackoverflow.com/questions/1437790/how-to-snap-a-directional-2d-vector-to-a-compass-n-ne-e-se-s-sw-w-nw
				get{
					GVector gv=this;
					int segmentCount=16;
					int compassSegment = (((int) Math.Round(Math.Atan2(gv.Y, gv.X) / (2 * Math.PI / segmentCount))) + segmentCount) % segmentCount;
                    return (Direction)compassSegment;
				}
			}
		#endregion
</pre>
<p>Another simply analysis gives you the orientation of the device, that means where the display is facing to.</p>
<pre lang="csharp" escaped="true">            //changed to match CN50 XYZ directions
            public ScreenOrientation ToScreenOrientation()
            {
                if (Math.Abs(X) > Math.Abs(Y))
                {
                    if (Math.Abs(X) > Math.Abs(Z))
                    {
                        if (X > 0)
                            return ScreenOrientation.ReverseLandscape;     //changed from Landscape
                        return ScreenOrientation.Landscape;                //changed from ReverseLandscape
                    }
                }
                else if (Math.Abs(Y) > Math.Abs(Z))
                {
                    if (Y > 0)
                        return ScreenOrientation.ReversePortrait;       //changed from Portrait
                    return ScreenOrientation.Portrait;                  // changed from ReversePortrait
                }

                if (Z > 0)
                    return ScreenOrientation.FaceUp;    //this is different to HTC
                return ScreenOrientation.FaceDown;      //this is different to HTC
            }
        }
</pre>
<p>When you take a look at the vectors when you move the device slow and fast, you will see the xyz values changing and if you add the absolute length over the time, you will get a cumulated &#8216;force&#8217;.</p>
<p><a rel="attachment wp-att-923" href="http://www.hjgode.de/wp/2011/02/13/mobile-development-shake-that-thing/vectors-analysis/"><img class="alignnone size-medium wp-image-923" title="vectors-analysis" src="http://www.hjgode.de/wp/wp-content/uploads/2011/02/vectors-analysis-300x170.gif" alt="" width="300" height="170" /></a><br />
 [image vectors-analysis.gif]<br />
 the upper graphics shows the x,y,z values of the sensor and the lower graphic shows the accumulated force over the time</p>
<p>The shaker classes implement different &#8216;shake&#8217; detection algorithms. The simplest one is to add current force value to a cache and compare the average values with a defined threshold, see ShakeClass1.cs:</p>
<pre lang="csharp" escaped="true">...
        ///
        /// this function uses every direction for its own shake detection
        /// 

        public override void addValues(GVector gv){
            //code is from android where 9.8m/s^² is normal
            //cn50 gives 0.98m/s^² so we multiply the CN50 values with 10
            gv = gv.Scale(10);

            addToSensorCache(_X_Cache, gv.X);
            addToSensorCache(_Y_Cache, gv.Y);
            addToSensorCache(_Z_Cache, gv.Z);

            this.Logger(gv.ToString());
            if(isShaking(_X_Cache, gv.X) ||
                isShaking(_Y_Cache, gv.Y) ||
                isShaking(_Z_Cache, gv.Z) )
            {
                this.OnShakeDetected(gv);
            }
        }
...
        private bool isShaking(Queue cache, double currentValue)
        {
            double average = 0;
            foreach (double d in cache)
            {
                average += d;
            }
            average = average / cache.Count;
            this.Logger(String.Format("ShakeClass1: isShaking: average: {0} current: {1} treshold:{2} diff:{3}", average, currentValue, _shakeTreshold, Math.Abs(average - currentValue)));
            return Math.Abs(average - Math.Abs(currentValue)) > _shakeTreshold;
        }
...
</pre>
<p>The most extended algorithm is inside Movement1.cs (see also <a href="http://www.google.co.uk/url?sa=t&amp;source=web&amp;cd=6&amp;ved=0CDwQFjAF&amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.120.296%26rep%3Drep1%26type%3Dpdf&amp;ei=wTMHTf_NL8e3hQf-oZXtBw&amp;usg=AFQjCNGgZnlYRvBzKg4uJRveSwVHhxIa-g&amp;sig2=URThwmeDoZF2JdCMj2Babg" target="_blank">Accelerometer_WBSN.pdf</a>):</p>
<pre lang="csharp" escaped="true">using System;
using System.Collections.Generic;
using System.Text;

namespace Movedetection
{
    /// challenge: recognize a gesture pattern
    /// Detect movement (Accelerometer_WBSN.pdf)
    /// 1. calc the actual acceleration: Length=sqrt(x*x+y*y+z*z)
    /// 2. get the diff to the previous DeltaAcceleration: LengthNow - LengthPrevious
    /// 3. get the average of deltas for about 1 sec (should be 20 measurements): SUM(DeltaAccelerations)/sps; //sps=samples per second
    /// 

    class MovementClass1:MovementClass
    {

        public MovementClass1(string s)
        {
            base.name = s;
            this.setTreshold(.2d, 0.5d);
            myQueue = new LimitedQueue(_queueLength);

            myAverages = new LimitedQueue(_queueLength);

            //need at least 3 seconds recording size, but only record crossing values
            myCrossUPs = new LimitedQueue(_queueLength);
            myCrossDOWNs = new LimitedQueue(_queueLength);

            myGmin = 0.2d; //was 0.9d but we get a deltaAverage of about around 0.14
            myTmin = 10; // 15 is equal to 0.75 seconds if samples per seconds is 20

            _treshCountRMS = 2000;  //should be 3000 for 60 samples in 3 seconds at 20 samples/second,
                                 //BUT we only see ~2 samples per second

            basicLogger("Movement1 Class\r\nx\ty\tz\ttick\tdeltaG");
        }

        public override void setTreshold(double high, double low)
        {
            myGmin = high;
            myRMSmin = low;
        }

        public override void addValues(GMVector gv)
        {
            GMVector gvOld;
            if (myQueue.Count>0)// !_firstCall)
            {
                //_samplesPerSecond=
                //calc samples per second
                if (!_samplesPerSecondsCalulated)
                {
                    if (myQueue.Count > 10)
                    {
                        GMVector[] myQueueArray = myQueue.ToArray();
                        ulong iSamplesCount = 0;
                        ulong iTickSum = 0;
                        ulong tickDiff = 0;
                        for (int c = myQueueArray.Length - 1; c > 1; c--)
                        {
                            iSamplesCount++;
                            tickDiff = myQueueArray[c].Ticks - myQueueArray[c - 1].Ticks;
                            iTickSum += tickDiff;
                        }
                        _samplesPerSecond = (uint)(1000 / (iTickSum / iSamplesCount)); // number of samples per second, ticks stored as milliseconds
                        _samplesPerSecondsCalulated = true;
                    }
                }
                //get and store delta
                gvOld = myQueue.Peek();
                //calculate deltaG for current and last sample
                double deltaG = Math.Abs(gv.Length-gvOld.Length);

                //save for later use
                gRMSAverage currentRMS=new gRMSAverage(deltaG, gv.Ticks);
                myAverages.Enqueue(currentRMS);

                basicLogger(string.Format("{0}\t{1}\t{2}\t{3}\t{4}",
                    gv.X, gv.Y, gv.Z,
                    gv.Ticks,
                    deltaG));

                /* Theory:
                 * RSD: Rapid Shake Detection
                 * acceleration change is the sum of the delta G between consecutive samples divided
                 * by the number of samples per second
                 * Drastic Movement
                 *  average acceleration change exceeds about 0.9G per sample (50ms period)
                 *  calculated over the last .75 seconds
                 * Sustained Movement
                 *  more fequently exceed an acceleration of about 0.5G (0.5G acceleration change per sample)
                 *  exceed 0.5G value within time frame for non-consecutive samples (cross counter)
                 *  time frame is set to reset after 60 non-consecutive (about 3 seconds at 50ms per sample) samples below 0.5G
                */

                //test for condition1
                bool bCondition1=false;
                if (myAverages.Count > 1)
                {
                    bCondition1 = condition1(currentRMS);
                }

                //test for condition2
                bool bCondition2=false;
                if (myAverages.Count > 1)
                {
                    gRMSAverage lastRMS = myAverages.Peek();
                    bCondition2 = condition2(currentRMS, lastRMS);
                }

                //===============================================================================================
                //start when queue is filled
                if (myQueue.Count >= 20)
                {
                    //rapid shake detection (RSD)
                    //Condition1: have at least an average of 0.9G for at least .75 second
                    if(bCondition1 &amp; bCondition2)
                        OnMoveDetected(gv);
                }//start with filled queue
            }
            //else
            //    _firstCall = false;

            myQueue.Enqueue(gv);

            gvOld = gv;
        }

        /* Theory:
         * RSD: Rapid Shake Detection
         * acceleration change is the sum of the delta G between consecutive samples divided
         * by the number of samples per second
         * Drastic Movement (condition1)
         *  average acceleration change exceeds about 0.9G per sample (50ms period)
         *  calculated over the last .75 seconds
         */
        /// deltaG above 0.9G for at least .75 seconds
        ///
        private bool condition1(gRMSAverage currentRMS)
        {
            if (!_samplesPerSecondsCalulated)
                return false;

            bool bRet1 = false;
            //get average of values of last .75 seconds, tick diff is about 10ms between samples
            double sum = 0;
            int iSamples = 0;

            foreach (gRMSAverage gRMS in myAverages)
            {
                if (currentRMS.tick - gRMS.tick < 75 * 1000) //the ticks saved are milliseconds, .75seconds=75000 milliseconds
                {
                    sum += gRMS.deltaG;
                    iSamples++;
                }
            }
            //sum of deltas divided by samples per second
            double DeltaAverage = sum / _samplesPerSecond;// (iSamples * 4 / 3);

            Avg_deltaG_rms = DeltaAverage;

            //call back for information, the caller reads _Avg_deltaG_rms
            OnIdleDetected(new GMVector(0, 0, 0));

            //how many samples exceed the Gmin treshold
            int iCountG = 0;
            foreach (GMVector g in myQueue)
            {
                if (g.Length > DeltaAverage)
                    iCountG++;
            }
            //Condition1: have at least an average of 0.9G for at least .75 second
            if (DeltaAverage > myGmin){
                if (iCountG > myTmin)
                {
                    //delete all entries, RESET
                    myQueue.Clear();
                    //_firstCall = true;

                    //OnMoveDetected(gv);
                    bRet1 = true;
                }
            }
            return bRet1;
        }

        /// deltaG above .5G for more than 3 seconds and
        /// without deltaG below .5G within last 3 seconds
        private bool condition2(gRMSAverage currentRMS, gRMSAverage lastRMS){

            if (!_samplesPerSecondsCalulated)
                return false;

            bool bRet = false;
            crossDirection crossDir = crossDirection.unknown;
            if (currentRMS.deltaG > myRMSmin &amp;&amp; lastRMS.deltaG < myRMSmin)
            {
                //crossUp
                crossDir = crossDirection.crossUP;
            }
            else if (currentRMS.deltaG < myRMSmin &amp;&amp; lastRMS.deltaG > myRMSmin)
            {
                //crossDown
                crossDir = crossDirection.crossDown;
            }

            if (myCrossDOWNs.Count > 0)
            {
                gRMSAverage lastRMSup = myCrossDOWNs.Peek();
                if (crossDir == crossDirection.crossUP &amp;&amp; (currentRMS.tick - lastRMSup.tick) >= _treshCountRMS)
                {
                    if (myCrossUPs.Count > 0)
                    {
                        gRMSAverage lastRMSdown = myCrossDOWNs.Peek();
                        if ((currentRMS.tick - lastRMSdown.tick) > _treshCountRMS)
                            bRet = true;
                    }
                }
            }
            //enqueue current values
            if (crossDir == crossDirection.crossUP)
                myCrossUPs.Enqueue(currentRMS);
            if (crossDir == crossDirection.crossDown)
                myCrossDOWNs.Enqueue(currentRMS);
            return bRet;
        }
#region fields
        private uint _samplesPerSecond = 20;
        private bool _samplesPerSecondsCalulated = false;

        private enum crossDirection : int
        {
            unknown = 0,
            crossUP = 1,
            crossDown = -1,
        }

        private class gRMSAverage
        {
            private double _deltaG;
            public double deltaG
            {
                get { return _deltaG; }
            }
            private ulong _tick;
            public ulong tick
            {
                get { return _tick; }
            }
            public gRMSAverage(double delta, ulong tick)
            {
                _deltaG = delta;
                _tick = tick;
            }
        }

        /// store a list of acceleration data
        ///
        private LimitedQueue myQueue;

        ///
        /// store a list of relevant delta acceleration data and ticks
        ///
        private LimitedQueue myAverages;

        ///
        /// queue to record deltaG averages crossing from deltaG from <.5G to >.5G
        ///
        private LimitedQueue myCrossUPs;

        ///
        /// queue to record deltaG averages crossing from deltaG from >.5G to <.5G
        ///
        private LimitedQueue myCrossDOWNs;

        private int _queueLength = 20; //20 samples per second will be great
        ///
        /// how long should the 0.5 treshold be met
        /// 

        private uint _treshCountRMS = 3000; //should be normally 3 seconds
        public uint treshCountRMS
        {
            get { return _treshCountRMS; }
        }

        ///
        /// minimum G to exceed for shake detection
        ///
        private double myGmin=0.9;
        public double _Gmin
        {
            set { myGmin = value; }
        }

        ///
        /// minimum G to exceed for sustained movement detection
        /// 

        private double myRMSmin = 0.5;
        public double _RMSmin
        {
            get { return myRMSmin; }
            set { myRMSmin = value; }
        }

        private double myTmin;
        public double _Tmin
        {
            set { myTmin = value; }
        }

        private double Avg_deltaG_rms;
        public double _Avg_deltaG_rms
        {
            get { return Avg_deltaG_rms; }
        }
#endregion
        public static void basicLogger(string s)
        {
            string sFileName = @"\basicxyz.log.txt";
            System.IO.TextWriter tw = new System.IO.StreamWriter(sFileName, true);
            //tw.WriteLine(X.ToString() + "," + Y.ToString() + "," + Z.ToString() + "," + AngleX.ToString() + "," + AngleY.ToString());
            tw.WriteLine(s);
            tw.Flush();
            tw.Close();
        }

    }
}
</pre>
<p>So, now you can start to play with the code. I tried to include the sources of the shake detection "ideas" if you would like to see the original code or the information the code is based on.</p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=129" title="Downloaded 237 times">SnesorScan5 VS2005 SmartDevice Source Code</a> -  (Hits: 237, size: 97.24 kB)
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 5497px; width: 1px; height: 1px; overflow: hidden;">
<pre lang="csharp">Accelerometer_WBSN.pdf</pre>
</div>
<!-- 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%2F02%2F13%2Fmobile-development-shake-that-thing%2F&amp;title=Mobile+Development+%26%238211%3B+Shake+that+thing" 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%2F02%2F13%2Fmobile-development-shake-that-thing%2F&amp;title=Mobile+Development+%26%238211%3B+Shake+that+thing" 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%2F02%2F13%2Fmobile-development-shake-that-thing%2F&amp;title=Mobile+Development+%26%238211%3B+Shake+that+thing" 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%2F02%2F13%2Fmobile-development-shake-that-thing%2F&amp;T=Mobile+Development+%26%238211%3B+Shake+that+thing" 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%2F02%2F13%2Fmobile-development-shake-that-thing%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%2F02%2F13%2Fmobile-development-shake-that-thing%2F&amp;t=Mobile+Development+%26%238211%3B+Shake+that+thing" 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/02/13/mobile-development-shake-that-thing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development: Disable Windows Mobile 6.5 Start and Close Button</title>
		<link>http://www.hjgode.de/wp/2010/11/18/mobile-development-disable-windows-mobile-6-5-start-and-close-button/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-disable-windows-mobile-6-5-start-and-close-button</link>
		<comments>http://www.hjgode.de/wp/2010/11/18/mobile-development-disable-windows-mobile-6-5-start-and-close-button/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 13:03:47 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[6.5.3]]></category>
		<category><![CDATA[Close Button]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[sender-as-rectangle-windows-ce]]></category>
		<category><![CDATA[Start Button]]></category>
		<category><![CDATA[Subclassing]]></category>
		<category><![CDATA[taskbar]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[WM65]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=888</guid>
		<description><![CDATA[Windows Mobile 6.5.3. Class to subclass menu toolbar to disable Start and Close button clicks.]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>here is one other way to write a kios mode .NET application using a technique called SubClassing. The idea was born by a comment of redwolf2222 on this blog about how to <a href="http://www.hjgode.de/wp/2010/10/11/windows-mobile-hide-startbutton-in-winmo-6-5-x/">Hide Start and Close buttons on Windows Mobile 6.5 devices</a>. Redwolf2222 also provided a code snippet. Unfortunately it was incomplete and so I wrote my own class.</p>
<p><strong>Disable clicks on Start and Close button</strong></p>
<p>The demo project shows one dialog with two check boxes and you can easily test the function. If &#8220;StartButton Disabled&#8221; or &#8220;Close Button disabled&#8221; is checked, you cannot &#8216;click&#8217; the corresponding button any more:</p>
<p><a rel="attachment wp-att-889" href="http://www.hjgode.de/wp/2010/11/18/mobile-development-disable-windows-mobile-6-5-start-and-close-button/startbuttoncontrolwm65_2/"><img class="alignnone size-medium wp-image-889" title="StartButtonControlWM65" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/StartButtonControlWM65_2-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>You still &#8216;click&#8217; the buttons but the subclassed window will not &#8216;execute&#8217; your click. The buttons are part of the toolbar32 window which is a child of the menu_worker window. So first we have to follow the window tree.</p>
<p><strong>Find the right window</strong></p>
<pre escaped="true" line="1" lang="csharp">/// &lt;summary&gt;
/// SubClassing: Install the wndproc hook
/// &lt;/summary&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private bool hookWindow()
{
    //find taskbar
    IntPtr hWndTaskbar = FindWindow("HHTaskbar", IntPtr.Zero);
    if (hWndTaskbar == IntPtr.Zero)
        return false;
    //enable the taskbar, not realy necessary
    EnableWindow(hWndTaskbar, true);
    //already installed?
    if (oldWndProc == IntPtr.Zero)
    {
        //find the menu_worker window
        IntPtr hwndMenu_Worker = FindWindow("menu_worker", IntPtr.Zero);
        if (hwndMenu_Worker != IntPtr.Zero)
        {
            //get the child window which has the buttons on it
            IntPtr hwndToolbar = GetWindow(hwndMenu_Worker, GetWindow_Cmd.GW_CHILD);
            if (hwndToolbar != IntPtr.Zero)
            {
                _mHwnd = hwndToolbar;       //store to remember
                SubclassHWnd(hwndToolbar);  //subclass the wndproc
            }
        }
    }
    return true;
}
</pre>
<p><strong>Subclassing</strong></p>
<p>Now, as we have the window handle, the subclassing can be started:<br />
 <span id="more-888"></span></p>
<pre escaped="true" line="1" lang="csharp">private void SubclassHWnd(IntPtr hWnd)
{
    // hWnd is the window you want to subclass..., create a new
    // delegate for the new wndproc
    newWndProc = new Win32WndProc(MyWndProc);
    // subclass
    oldWndProc = SetWindowLong(hWnd, GWL_WNDPROC, newWndProc);
}
</pre>
<p>The installation of the &#8216;hook&#8217; is very simple. Just use SetWindowLong with the new window procedure. The old, original window procedure is saved for later use. We need it for example to call it for clicks outside the buttons and for all messages we don&#8217;t care about.</p>
<p>The &#8216;hook&#8217; or better the redirection will remain active until you install the old window procedure. So your device&#8217;s start and close button will not &#8216;work&#8217; as long as the hook is in place.</p>
<p><strong>The new window procedure</strong></p>
<pre escaped="true" line="1" lang="csharp">// this is the new wndproc, just show a messagebox on left button down:
private IntPtr MyWndProc(IntPtr hWnd, int msg, int wParam, int lParam)
{
    //is this a message for us?
    if (((msg == (int)WM_LBUTTONDOWN) || (msg == (int)WM_LBUTTONUP)) &amp;&amp; (this._mIsStartButtonDisabled || this._mIsCloseButtonDisabled) )
    {
        int x = ((int)lParam) &amp; 0xFFFF;
        int y = ((int)lParam) &gt;&gt; 16;

        bool isVGA;
        bool isQVGA;
        using (System.Windows.Forms.Control detector = new System.Windows.Forms.Control())
        {
            using (System.Drawing.Graphics gr = detector.CreateGraphics())
            {
                isVGA = gr.DpiY == 192;
                isQVGA = gr.DpiY == 96;
            }
        }

        RECT rect;
        GetWindowRect(hWnd, out rect); //get the rectangle of the menu_bar

        int width = Math.Max(rect.Left, rect.Right) - Math.Min(rect.Left, rect.Right);
        int height = Math.Max(rect.Bottom, rect.Top) - Math.Min(rect.Bottom, rect.Top);

        //width values are assumed
        int buttonWidth = (isQVGA | isVGA) ? 92 : 46;
        int buttonHeight = height; //(isQVGA | isVGA) ? 72 : 36;

        System.Drawing.Rectangle rectStartButton = new System.Drawing.Rectangle(0, 0, buttonWidth, buttonHeight);
        System.Drawing.Rectangle rectCloseButton = new System.Drawing.Rectangle(width - buttonWidth, 0, buttonWidth, buttonHeight);

        //check if enabled and click is inside the start or close button rectangle
        if(this._mIsStartButtonDisabled &amp;&amp; rectStartButton.Contains(x, y))
            return IntPtr.Zero;
        if (this._mIsCloseButtonDisabled &amp;&amp; rectCloseButton.Contains(x, y))
            return IntPtr.Zero;

        //if both are false, we have to provide the click to windows
        return CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);
    }
    else
        return CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);
}
</pre>
<p>Subclassing the window means that we redirect the window message procedure of the found window to our own, custom window procedure. This new procedure checks for WM_LBUTTONDOWN and WM_LBUTTONUP messages. Then the click position is checked and discarded if within the rectangle area of the Start and/or Close button. If the position is outside the calculated rectangles, the original window procedure is called.</p>
<p><strong>The demo code</strong></p>
<pre escaped="true" line="1" lang="csharp">public partial class StartButtonControl : Form
{
    StartButtonWM65.hwndutils _hwndutils = new StartButtonWM65.hwndutils();
    private bool _bInitializing = true;
    public StartButtonControl()
    {
        InitializeComponent();
        this.chkDisableStartButton.Checked = this._hwndutils.StartButtonDisabled;
        _bInitializing = false;
    }

    private void chkDisableStartButton_CheckStateChanged(object sender, EventArgs e)
    {
        if (_bInitializing)
            return;
        this._hwndutils.StartButtonDisabled = chkDisableStartButton.Checked;
    }

    private void mnuExit_Click(object sender, EventArgs e)
    {
        _hwndutils.Dispose();
        Application.Exit();
    }

    private void StartButtonControl_Closing(object sender, CancelEventArgs e)
    {
        _hwndutils.Dispose();
        Application.Exit();
    }

    private void chkCloseButton_CheckStateChanged(object sender, EventArgs e)
    {
        if (_bInitializing)
            return;
        this._hwndutils.CloseButtonDisabled = chkCloseButton.Checked;
    }
}
</pre>
<p>As you see, the usage of the class hwndutils is very simple. Dont forget to Dispose the hwndutils object before you exit your app.</p>
<p><strong>Downloads</strong><br />
 Visual Studion 2008 solution with demo project targeting Windows Mobile 6 SDK: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=128" title="Downloaded 834 times">StartButtonHookWM65 VS2008 source code and demo project</a> -  (Hits: 834, size: 18.53 kB)</p>
<p>Thanks to redwolf2222 for the great idea.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F&amp;title=Mobile+Development%3A+Disable+Windows+Mobile+6.5+Start+and+Close+Button" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F&amp;title=Mobile+Development%3A+Disable+Windows+Mobile+6.5+Start+and+Close+Button" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F&amp;title=Mobile+Development%3A+Disable+Windows+Mobile+6.5+Start+and+Close+Button" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F&amp;T=Mobile+Development%3A+Disable+Windows+Mobile+6.5+Start+and+Close+Button" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F18%2Fmobile-development-disable-windows-mobile-6-5-start-and-close-button%2F&amp;t=Mobile+Development%3A+Disable+Windows+Mobile+6.5+Start+and+Close+Button" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/11/18/mobile-development-disable-windows-mobile-6-5-start-and-close-button/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mobile Development: Yet another kiosk mode library</title>
		<link>http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-yet-another-kiosk-mode-library</link>
		<comments>http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 08:40:38 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[compact-framework-lockdown-mode]]></category>
		<category><![CDATA[DLL]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[HHTaskbar]]></category>
		<category><![CDATA[interop]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[start menu]]></category>
		<category><![CDATA[subclass]]></category>
		<category><![CDATA[taskbar]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=752</guid>
		<description><![CDATA[How to disable StartMenu clicks and Win key for kiosk mode application using a library]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>here is another kiosk mode library. It supports disabling clicks/taps on start menu icon and opening the Windows Mobile start menu using the win key (VKLWIN). Additionally there is a function to disable the whole StartMenu bar and one to make a window fullscreen without Done and Close button (uses SHFullScreen).</p>
<p>The functions are implemented in a DLL, so you can easily use them from C/C++, the dot net compact framework (CSharp or VB.NET), Java and so on.</p>
<p>Here is a list of the functions exported by the DLL:</p>
<pre escaped="true" lang="c">void __stdcall LockStartMenu(); // this will install the hook (subclass the taskbar window)
void __stdcall UnlockStartMenu();   // this will unhook TaskbarWindowProc from taskbar
void __stdcall LockStartBar();  // this disables the whole taskbar
void __stdcall UnlockStartBar();    // this enables the taskbar window
bool __stdcall Lockdown(TCHAR*);    // this will make the application with the window title fullscreen etc
bool __stdcall Unlockdown();    // this will 'normalize' the fullscreen window
</pre>
<p>I have included a deno application in C and .NET</p>
<p><a rel="attachment wp-att-759" href="http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/startlock1/"><img class="alignnone size-medium wp-image-759" title="StartLock1" src="http://www.hjgode.de/wp/wp-content/uploads/2010/09/StartLock1-225x300.gif" alt="" width="225" height="300" /></a> <a rel="attachment wp-att-760" href="http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/startlock2/"><img class="alignnone size-medium wp-image-760" title="StartLock2" src="http://www.hjgode.de/wp/wp-content/uploads/2010/09/StartLock2-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>The left shows normal window ce window and the right the same window after pressing the [Lockdown window].</p>
<p><span id="more-752"></span></p>
<h1>Usage and function</h1>
<h2>LockStartMenu and UnlockStartMenu</h2>
<p>To disable clicks on the StartMenu you use the function LockStartMenu(). This function subclasses (hooks) the HHTaskbar window procedure.</p>
<pre escaped="true" lang="c">void __stdcall LockStartMenu()
 {
   taskbarhWnd = FindWindow(TEXT("HHTaskBar"), NULL);
   if (taskbarhWnd != NULL)
   {
     WNDPROC p = TaskbarWindowProc;
     oldWindowProc = (WNDPROC)SetWindowLong(taskbarhWnd, GWL_WNDPROC, (long)p);
   }
 }
 </pre>
<p>Note about subclassing in windows<em><br />
 Subclassing a window means that your code gets executed on every message received by the original window. As you know, all windows have a central window procedure (wndproc). Every message to your window is going to this procedure. Normally you have a switch statement and case statements for the window messages you are interested to react on, like WM_CREATE, WM_PAINT, WM_LBUTTON, WM_KEYDOWN, WM_DESTROY etc. When you subclass a window, you install a new wndproc that is called before the original wndproc of the window. So you can manipulate things outside the original WndProc. You dont need the source code of the original window or application. Subclassing is used here to hook into the wndproc of HHTaskbar (the window class name of the window that is responsible for the windows mobile taskbar at the top of your screen).</em></p>
<p>The new window procedure checks the click coordinates for left button clicks (WM_LBUTTONDOWN). If the x and y values of the click location are within the height of the taskbar and up to 2/3 of the screen width, the click is not forwarded to the taskbar window. So HHTaskbar does not get notified about the click and will not open the StartMenu.</p>
<pre escaped="true" lang="c">LRESULT CALLBACK TaskbarWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
  if (message == WM_LBUTTONDOWN)
     {
        POINTS pts;
        pts.x = LOWORD(lParam);
        pts.y = HIWORD(lParam);

        //the hot area of the StartMenu extends with the length of the current window title text
        //we get the actual screen width and then assume half the width as hot area
        int screenwidth = GetSystemMetrics(SM_CXSCREEN);
        if(screenwidth!=0)
           MAX_START_X = (int)(screenwidth * 2 / 3);
        if (pts.y &lt; MAX_START_Y &amp;&amp; pts.x &lt;)
                       return TRUE;
     }
  ...
 </pre>
<p>The new Taskbar window procedure also checks, if the user has pressed the Win key. The win key (VK_LWIN) would bring up the start menu too. The function TaskbarWindowProc therefor also checks for key messages and filters the VKLWIN keypress. So the user is not able to invoke the start menu by pressing the win key.</p>
<pre escaped="true" lang="c">...
    if (message == WM_KEYDOWN &amp;&amp; wParam == VK_LWIN &amp;&amp; lParam == 1)
       return TRUE;
   return CallWindowProc(oldWindowProc, hWnd, message, wParam, lParam);
}
 </pre>
<p>Messages that are not filtered are forwarded to the original window procedure of HHTaskbar.</p>
<p>Why not just disable the whole taskbar? This is for applications that will not lock you down completely. If you disable the whole taskbar (see also LockStartBar()), you will not be able to click the connection, volume and close symbols on the taskbar.</p>
<p>Here is a screen shot of the .NET demo app with a long title. Only the area inside the red rectangle is blocked. The remainder of the taskbar is clickable.</p>
<p><a rel="attachment wp-att-763" href="http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/longtitle_/"><img class="alignnone size-medium wp-image-763" title="LongTitle_" src="http://www.hjgode.de/wp/wp-content/uploads/2010/09/LongTitle_-225x300.png" alt="" width="225" height="300" /></a></p>
<p>As you see with the DotNet demo app, you can lock the user from opening the startmenu, but you can launch an external app (like the calculator) and the startmenu is still blocked. In the external app, the user can still click the (X) to close (hide) the app and is back in our kiosk application demo.</p>
<p>The second function UnlockStartMenu() will restore the original WndProc of HHTaskbar and &#8216;unhook&#8217; our window procedure. So the start menu will then work as usual.</p>
<pre escaped="true" lang="c">void __stdcall UnlockStartMenu()
{
 if(bStartmenuLocked){
   if (oldWindowProc!=NULL)
      oldWindowProc = (WNDPROC)SetWindowLong(taskbarhWnd, GWL_WNDPROC, (long)oldWindowProc);
   oldWindowProc = NULL;
   bStartmenuLocked=false;
 }
}
</pre>
<p>This function will restore the original window procedure and unhooks our new wndpro. So HHTaskbar should then behave like normally.</p>
<h2>LockStartBar and UnlockStartBar</h2>
<p>The second pair of the DLL functions is called LockStartBar() and UnLockStartBar(). The first one looks for the window with the class name HHTaskbar and will then disable the window. Disabling a window prevents the window procedure from getting any more window messages. So HHTaskbar will not receive any click as long as the window is disabled.</p>
<pre escaped="true" lang="c">void __stdcall LockStartBar()
{
 //Disable the whole HHTaskbar window
 if(!bStartbarLocked){
   taskbarhWnd = FindWindow(TEXT("HHTaskBar"), NULL);  
   if (taskbarhWnd != NULL)
   {
     EnableWindow(taskbarhWnd, false);
     bStartbarLocked=true;
   }
 }
}
</pre>
<p>This function and the UnlockStarBar() function are very simple.</p>
<pre escaped="true" lang="c">void __stdcall UnlockStartBar()
{
 if (bStartbarLocked)
 {
   taskbarhWnd = FindWindow(TEXT("HHTaskBar"), NULL);  
   if (taskbarhWnd != NULL)
   {
     EnableWindow(taskbarhWnd, true);
     bStartbarLocked=false;
   }
 }
}
</pre>
<p>But as some .NET and JAVA and other non-native programming languages don&#8217;t have the essential windows functions like FindWindow etc, I have included these functions in the DLL for easy use.</p>
<h2>LockDown(window title) and UnLockDown()</h2>
<p>The last pair  of functions is using a combination of kiosk mode techniques I am aware of: LockDown(TCHAR*) and UnLockDown().</p>
<pre escaped="true" lang="c">bool __stdcall Lockdown(TCHAR *windowText)
{
 // If the application is already locked down, don't attempt to lock it down again.
 if (hWndLockdown)
   return TRUE;
 if(!bLockedDown){
   HWND hWnd = 0;
   TCHAR *str;
   str = (TCHAR*) malloc( MAX_PATH * sizeof(TCHAR));  
   wcscpy (str, windowText);
   if ((!str) || (wcslen(str) &lt;= 0))
     hWnd = FindRootWindowByFocus();
   else
     hWnd = FindRootWindowByName(str);
   if (!hWnd)
     return FALSE;
   free(str);
   SetForegroundWindow(hWnd);     // Required before SHFullScreen Calls
   SHDoneButton(hWnd, SHDB_HIDE);
   SHFullScreen(hWnd, SHFS_HIDESTARTICON|SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON);
   MoveWindow(hWnd, 0,0, 240,320, TRUE);  // Expand to use the entire screen 

   hWndLockdown = hWnd;
   LockStartMenu();
   bLockedDown=true;
 }
 return TRUE;
}
</pre>
<p>First the function tests, if the lockdown for the window with the given title text was already done. If not, it searches the window handle of a window with the title specified. If a window is found, it will be set to the foreground and then the MS API calls to make a window fullscreen are invoked for the window handle. The window is also made fullscreen (with currently hardcoded screen dimensions, change this, if you need) and our LockStartMenu function is called.</p>
<p>The last function in our list tries to revert the function of  LockDown and tries to restore the window to a normal state.</p>
<p>Why did I wrote these two LockDown functions? They make it very easy for DotNet and JAVA programmers to make there windows mobile application a fullscreen kiosk mode application by just calling LockDown(window title) with the title of the window to make fullscreen.</p>
<pre escaped="true" lang="csharp">private void btn_LockDown_Click(object sender, EventArgs e)
 {
 string title = this.Text;
 if (!_bFullScreen)
 {
   StartLock.Lockdown(title);
   _bFullScreen = true;
   label1.Text = "Form made fullscreen";
 }
 else
   {
     label1.Text = "Form was already fullscreen";
   }
 }
</pre>
<p><em>(See also the video at <a href="http://community.intermec.com/t5/General-Development-Developer/disappear-or-block-start-menu-in-all-of-application/m-p/4695#M2591" target="_blank">community.intermec.com</a>.)</em></p>
<p>Doing fullscreen from Win32 native C is much easier than writing all the PInvokes you needed to get the same result.</p>
<h2>Downloads</h2>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=115" title="Downloaded 568 times">DotNet LockDown Demo Application</a> - A demo showing the use of the StartLock DLL functions. (Hits: 568, size: 47.77 kB)
<p><br class="spacer_" /></p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=116" title="Downloaded 487 times">StartLock DLL source code and demo app (embedded visual c++ 4.0)</a> - The StartLock DLL and a demo application written in embedded visual c++ 4.0 (Hits: 487, size: 143.84 kB)
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F&amp;title=Mobile+Development%3A+Yet+another+kiosk+mode+library" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F&amp;title=Mobile+Development%3A+Yet+another+kiosk+mode+library" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F&amp;title=Mobile+Development%3A+Yet+another+kiosk+mode+library" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F&amp;T=Mobile+Development%3A+Yet+another+kiosk+mode+library" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F09%2F02%2Fmobile-development-yet-another-kiosk-mode-library%2F&amp;t=Mobile+Development%3A+Yet+another+kiosk+mode+library" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/09/02/mobile-development-yet-another-kiosk-mode-library/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Writing a tftp server windows service</title>
		<link>http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=writing-a-tftp-server-windows-service</link>
		<comments>http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 17:00:47 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[tftp]]></category>
		<category><![CDATA[tftp daemon]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[windows service]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=620</guid>
		<description><![CDATA[A tftp server running as service on windows. Includes tftpUtil class library and service control source code in csharp.]]></description>
			<content:encoded><![CDATA[<p>For an actual project I needed a tftp server service for a Windows 2003 server. I looked around in internet and only found tftp servers running in user space, no real windows service. So I searched for source code applications I could use and found tftpUtil at sourceforge.net (http://sourceforge.net/projects/tftputil/). Although the short description states it would implement a service, it does not in reality. But the tftpUtil class was more or less easy to use and so I started to write a service &#8216;wrapper&#8217; around it.</p>
<pre lang="csharp">        protected override void OnStart(string[] args)
        {
            AddLog("OnStart entered...");
            StartTFTPServer();
...
        }</pre>
<p><span id="more-620"></span></p>
<pre lang="csharp">        protected override void OnStop()
        {
            tftp.StopListener();
            if (TFTPServerThread != null)
                TFTPServerThread.Abort();
            TFTPServerThread = null;
            timerEvents.Stop();
            StopTFTPServer();
            GC.Collect();

        }</pre>
<p>The StartTFTPServer code uses the same class file ServerSettings.cs as used in the desktop app project (tftpUtilSvcSettings), this is easier to manage:</p>
<pre lang="csharp">            try
            {
                AddLog("CreateTFTPFromReg reading path");
                Path = svcSettings.sPath;
                LoggingLevel = svcSettings.LoggingLevel;
                DisplayLevel = svcSettings.SendEventLevel;
                FileAccess = svcSettings.FileAccess;
                AllowOptions = svcSettings.AllowOptions;
                RRQWRQStateCheck = svcSettings.RRQWRQStateCheck;

                AddLog("CreateTFTPFromReg reading IPstring");
                string IPstring = svcSettings.ServerIPAddr;
                if (IPstring.ToLower() == "any")
                    ServerIPAddr = System.Net.IPAddress.Any;
                else
                    System.Net.IPAddress.TryParse(IPstring, out ServerIPAddr);

                AddLog("CreateTFTPFromReg reading ServerUDPPort");
                ServerUDPPort = Convert.ToInt32(svcSettings.ServerUDPPort);
                iTimeout = Convert.ToInt32(svcSettings.Timeout);
                Resend = Convert.ToInt32(svcSettings.Resend);

                AddLog("CreateTFTPFromReg reading LoggingMethodInfo");
                LoggingMethodInfo[0] = svcSettings.LoggingMethod;
                LoggingMethodInfo[1] = svcSettings.LoggingOptions;

                //bool ShowAlert = false;
                AddLog("CreateTFTPFromReg reading BlockedIPs");
                BlockedIPs = svcSettings.BlockedIPs;

                AddLog("CreateTFTPFromReg starting new TFTPServer(...)");
                if (ServerIPAddr == null)
                    tftp = new TFTPServer(ServerUDPPort, Path, LoggingLevel, DisplayLevel, FileAccess, AllowOptions, RRQWRQStateCheck, Resend, iTimeout, LoggingMethodInfo, BlockedIPs);
                else
                    tftp = new TFTPServer(ServerUDPPort, Path, LoggingLevel, DisplayLevel, FileAccess, AllowOptions, RRQWRQStateCheck, Resend, iTimeout, LoggingMethodInfo, BlockedIPs, ServerIPAddr);
                returnval = true;
                AddLog("CreateTFTPFromReg everything seems to be OK");
            }
            catch (Exception ex)
            {
                AddLog("CreateTFTPFromReg EXCEPTION:" + ex.Message);
            }
            return returnval;</pre>
<p><strong>Changing service settings</strong></p>
<p>As I would like to control the service later and change settings, I needed a way to &#8216;communicate&#8217; with the server. I started with using the registry, but that did not work first. The service was unable to access [HKLM]Software\tftpUtilSvc. I researched and found the idea to use [HKU].Default\Software\tftpUtilSvc. Although the registry location location does not look nice (I mean service parameters have to reside below HKLM, but who cares), I tried the HKEY_USER.Default location and the service was able to load the values from the registry. Did not find any reference, why the service cannot access other root registry trees.</p>
<p>Here is my ugly &#8220;tftpUtilSvcSettings&#8221; application:</p>
<p><a href="http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/tftputilsvccontrol/" rel="attachment wp-att-623"><img class="alignnone size-full wp-image-623" title="tftpUtilSvcControl" src="http://www.hjgode.de/wp/wp-content/uploads/2010/06/tftpUtilSvcControl.gif" alt="" width="573" height="334" /></a> <a href="http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/tftputilsvccontrol0/" rel="attachment wp-att-1245"><img class="alignnone size-full wp-image-1245" title="tftpUtilSvcControl0" src="http://www.hjgode.de/wp/wp-content/uploads/2010/06/tftpUtilSvcControl0.gif" alt="" width="573" height="334" /></a></p>
<p>Although the tftpUtil code from sourceforge already contained code to write/read tftp settings to/from registry, it was not very clear and straight. I implemented a ServerSettings class and changed all direct references to the registry to this class. Inside the class, ServerSettings.cs, the values are saved/restored to the registry. As I did not like to change to much of the original tftpUtil class, there may be strange looking contructs and possible duplicate internal values.</p>
<p>During my debugging tests, the service did not start/stop correctly sometimes, due to errors in code. As the service remained in a disabled state, I had to rename all tftpUtilSvc service names to be able to test one more time without having to reboot my PC. If a service gets into this state, the service control manager is unable to remove the service as &#8220;InstallUtil.exe /u&#8221; was unable to uninstall the &#8216;broken&#8217; service.</p>
<p><strong>The service installer and controller</strong></p>
<p>The tftp server service should later run on a Windows 2003 server and as I did not like to copy InstallUtil and possibly other files onto the server and then run InstallUtil.exe to install the service, I researched and found some cool CSharp code to install/uninstall/start/stop/restart a servce from code. This code has been integrated into the tftpUtilSvcSettings application (see ServiceUtils.cs) and so there is no real need for an installer. It is possible to just copy the files</p>
<p>nspring.dll<br />
TFTPUtil.dll<br />
tftpUtilSvc.exe<br />
tftpUtilSvcSettings.exe</p>
<p>into one directory and then launch tftpUtilSvcSettings from there (assumed the DotNet runtimes are already installed). Then you can install and start the service directly from the tftpUtilSettings application.</p>
<p><strong>A tftp test client</strong></p>
<p>Included with the source code of tftpUtil of sourceforge is a project called &#8220;TFTPUtil Client GUI&#8221;. The name made me thing this is a tftp client I could use to test the server. BUT this is not a tftp client, it is just a dialog driven tftpUtil server. To test the tftp server I finally used also code found in internet: tftpClient at CodeProject.com. It is very simple code, no threading, no events, no progress indicator. I added a very simple interface and included the tftpClient class file to be able to do simple tests against the tftpUtil service. The tftpClient project is available as separate download for interested readers.</p>
<p><a href="http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/tftpclient/" rel="attachment wp-att-622"><img class="alignnone size-full wp-image-622" title="tftpClient" src="http://www.hjgode.de/wp/wp-content/uploads/2010/06/tftpClient.gif" alt="" width="323" height="217" /></a></p>
<p><strong>Downloads (Visual Studio 2008)</strong></p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=102" title="Downloaded 463 times">tftpUtil service C# code</a> - a tftp service written with tftpUtil (sourceforge) (Hits: 463, size: 422.84 KB)
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=103" title="Downloaded 403 times">tftpClient C# source code</a> - A simple GUI for the CodeProject tftpClient class (Hits: 403, size: 38.29 KB)
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F&amp;title=Writing+a+tftp+server+windows+service" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F&amp;title=Writing+a+tftp+server+windows+service" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F&amp;title=Writing+a+tftp+server+windows+service" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F&amp;T=Writing+a+tftp+server+windows+service" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F06%2F09%2Fwriting-a-tftp-server-windows-service%2F&amp;t=Writing+a+tftp+server+windows+service" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2010/06/09/writing-a-tftp-server-windows-service/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KeyWedge: a serial port to keyboard message connector</title>
		<link>http://www.hjgode.de/wp/2009/10/22/keywedge-a-serial-port-to-keyboard-message-connector/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=keywedge-a-serial-port-to-keyboard-message-connector</link>
		<comments>http://www.hjgode.de/wp/2009/10/22/keywedge-a-serial-port-to-keyboard-message-connector/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 07:49:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[barcode scanner]]></category>
		<category><![CDATA[KeyWedge]]></category>
		<category><![CDATA[Serial Port]]></category>
		<category><![CDATA[Wedge Scanner]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=211</guid>
		<description><![CDATA[This tool is for mobile computers to fill keyboard buffer with data from a serial port. This is often needed to get serial port connected barcode scanner&#8217;s data into applications if there is no other way. [Content transfered from http://hjgode.de/dev/keywedge] This is a simple keywedge program. It takes serial input and simulates keystrokes with the [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>This tool is for mobile computers to fill keyboard buffer with data from a serial port. This is often needed to get serial port connected barcode scanner&#8217;s data into applications if there is no other way.<br />
</em></strong></p>
<p>[Content transfered from http://hjgode.de/dev/keywedge]</p>
<p>This is a simple keywedge program. It takes serial input and simulates keystrokes with the chars received. It has been done, as the ITC(1) CN3 does not support a serial wedge but the vehicle dock has a serial port where you can connect a cabled serial barcode scanner. Similar commercial applications are ceLinq and TWedgeCE.</p>
<p><a href="http://www.hjgode.de/wp/2011/11/10/keywedge-updated/">10. nov. 2011: Code updated</a></p>
<h2><span id="more-211"></span>Installation</h2>
<p>Just copy the exe onto your device and you are done. You can also prepare a CAB file yourself and pre-configure the options. KeyWedge uses the following settings from the registry.</p>
<h3>The registry options</h3>
<pre>REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\HGO\KeyWedge]
"parity"=dword:00000000
;               0  NOPARITY
;               1  ODDPARITY
;               2  EVENPARITY
;               3  MARKPARITY
;               3  SPACEPARITY
"stopbits"=dword:00000000
;               0  ONESTOPBIT
;               1  ONE5STOPBITS
;               2  TWOSTOPBITS
"databits"=dword:00000008
;        7
;        8
;       16
"handshake"=dword:00000003
;       1       Xon/Xoff
;       2       Hardware
;       3       None
"baudrate"=dword:0000e100
;         9600
;        19200
;        38400
;        57600
;       115200
"comport"="COM4:"
;       string with trailing :

"sendcharbychar"=dword:00000000
;       1       send  byte for byte as received
;       0       send  keys when \n received</pre>
<p>Download reg file: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=40" title="Downloaded 2198 times">KeyWedge Sample Registry File</a> -  (Hits: 2198, size: 581 bytes)</p>
<h2>Starting KeyWedge</h2>
<p>Just tap the exe with file explorer or place a link in \Windows\Programs and tap the symbol then in Start-Programs. As started. keywedge will not show a normal window, just an icon on the today screen. If you like KeyWedge to start with every boot, place a shortcut into the \Windows\StartUp folder.</p>
<p><img class="alignnone size-medium wp-image-213" title="keywedge on today screen" src="http://www.hjgode.de/wp/wp-content/uploads/2009/10/keywedge021-225x300.gif" alt="keywedge on today screen" width="225" height="300" /></p>
<p>As long as KeyWedge has a connection to the serial port, it will show a green icon on the today screen.</p>
<p><strong>As long as the application window is open and you are setting the options, KeyWedge suspends the communication and will show a yellow icon on the today screen!</strong></p>
<p>If the icon on the today screen is showing red, then keywedge is unable to connect to the serial port.</p>
<h2>Configuration</h2>
<p>To configure keywedge, tap the sysmbol on the today screen. You will get a message box.<br />
Tap [No] to get access to the keywedge window.</p>
<p>If you select [Yes], keywedge exits and stops running.<br />
If you select [Cancel] the window is closed and keywedge resumes its communication thread.</p>
<p>In keywedge window select File-Options to get access to the options dialog. Here you can type the communication port to be used and specify the communication parameters.</p>
<p><img class="alignnone size-medium wp-image-214" title="keywedge options access" src="http://www.hjgode.de/wp/wp-content/uploads/2009/10/keywedge041-225x300.gif" alt="keywedge options access" width="225" height="300" /> <img class="alignnone size-medium wp-image-215" title="keywedge options screen" src="http://www.hjgode.de/wp/wp-content/uploads/2009/10/keywedge051-225x300.gif" alt="keywedge options screen" width="225" height="300" /></p>
<p>If you activate &#8216;Send Char by Char&#8217;, keywedge will send every char received by the comm port immediately as keytrokes.</p>
<p>If &#8216;Send Char by Char&#8217; is deactivated, keywedge sends the chars received via the comm port as soon as it encounters a \n char (a newline char) or when the buffer limit is reached (actually 1000 bytes),</p>
<p>When you are done setting your options, tap [OK] in the options dialog. The settings will be shown in a message box and saved in the registry. Tap again (OK) to close the message box.</p>
<p>If you don&#8217;t like to change the settings, tap [Cancel] in the options dialog. The settings will then not been changed.</p>
<p>To resume the comm thread and to have KeyWegde doing its work, you have to select File-Hide.</p>
<p><img class="alignnone size-medium wp-image-216" title="keywedge hide to activate" src="http://www.hjgode.de/wp/wp-content/uploads/2009/10/keywedge071-225x300.gif" alt="keywedge hide to activate" width="225" height="300" /></p>
<p><span style="font-size: large;"><strong>As long as the KeyWedge window is not hidden, KeyWedge will NOT do any comm work!</strong></span></p>
<p>If you like to end KeyWedge, select File-Exit.</p>
<h2>Version 1.3:</h2>
<p>Changed the background threads so you should be able to let the tool AutoStart. Removed obsolete msgbox.</p>
<p>Download executable only: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=41" title="Downloaded 373 times">KeyWedge ARMv4i</a> - The KeyWedge executable for ArmV4i (thumb) compatible Windows Mobile devices (Hits: 373, size: 48.99 KB)</p>
<p>Download Source code: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=42" title="Downloaded 381 times">KeyWedge Embedded Visual C 4 Source Code</a> -  (Hits: 381, size: 231.93 KB)</p>
<hr />
<p>(1) ITC is <img class="alignnone size-full wp-image-217" title="itc" src="http://www.hjgode.de/wp/wp-content/uploads/2009/10/itc.gif" alt="itc" width="95" height="30" /></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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%2F&amp;title=KeyWedge%3A+a+serial+port+to+keyboard+message+connector" 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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%2F&amp;title=KeyWedge%3A+a+serial+port+to+keyboard+message+connector" 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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%2F&amp;title=KeyWedge%3A+a+serial+port+to+keyboard+message+connector" 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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%2F&amp;T=KeyWedge%3A+a+serial+port+to+keyboard+message+connector" 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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%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%2F2009%2F10%2F22%2Fkeywedge-a-serial-port-to-keyboard-message-connector%2F&amp;t=KeyWedge%3A+a+serial+port+to+keyboard+message+connector" 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/2009/10/22/keywedge-a-serial-port-to-keyboard-message-connector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GAPI (GXOpenInput and GXCloseInput) will be removed for Windows Mobile 6.5</title>
		<link>http://www.hjgode.de/wp/2009/05/09/gapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65</link>
		<comments>http://www.hjgode.de/wp/2009/05/09/gapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65/#comments</comments>
		<pubDate>Sat, 09 May 2009 05:31:29 +0000</pubDate>
		<dc:creator>hjgode</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[AllKeys]]></category>
		<category><![CDATA[GAPI]]></category>
		<category><![CDATA[GXOpenInput]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=3</guid>
		<description><![CDATA[just say no to GAPI – What you need to know about AllKeys and input management
GXOpenInput and GXCloseInput can be rplaced by AllKeys(bEnable). MS will discontinue GAPI with WM6.5!]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>I just started this blog. I will import the existing stuff from <a class="linkification-ext" title="Linkification: http://hjgode.de/dev" href="http://hjgode.de/dev">hjgode.de/dev</a> from time to time. But now, here is my first post.</p>
<p>Microsoft decided to discontinue GAPI. That is OK for me, as I only use GXOpenInput and GXCloseInput to disable the hijacking of function keys and to have a kiosk application that dies the user not reach the OS.</p>
<p><span id="more-3"></span>I discovered this at community.intermec.com. There is a message linking to <a class="linkification-ext" title="Linkification: http://blogs.msdn.com/windowsmobile/archive/2009/05/06/just-say-no-to-gapi-what-you-need-to-know-about-allkeys-and-input-management.aspx" href="http://blogs.msdn.com/windowsmobile/archive/2009/05/06/just-say-no-to-gapi-what-you-need-to-know-about-allkeys-and-input-management.aspx">http://blogs.msdn.com/windowsmobile/archive/2009/05/06/just-say-no-to-gapi-what-you-need-to-know-about-allkeys-and-input-management.aspx</a>.</p>
<p>I will test the function of BOOL AllKeys(BOOL bEnable) and if it works like GXOpenInput() I hace no concerns about using it instead.</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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%2F&amp;title=GAPI+%28GXOpenInput+and+GXCloseInput%29+will+be+removed+for+Windows+Mobile+6.5" 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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%2F&amp;title=GAPI+%28GXOpenInput+and+GXCloseInput%29+will+be+removed+for+Windows+Mobile+6.5" 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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%2F&amp;title=GAPI+%28GXOpenInput+and+GXCloseInput%29+will+be+removed+for+Windows+Mobile+6.5" 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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%2F&amp;T=GAPI+%28GXOpenInput+and+GXCloseInput%29+will+be+removed+for+Windows+Mobile+6.5" 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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%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%2F2009%2F05%2F09%2Fgapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65%2F&amp;t=GAPI+%28GXOpenInput+and+GXCloseInput%29+will+be+removed+for+Windows+Mobile+6.5" 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/2009/05/09/gapi-gxopeninput-and-gxcloseinput-will-be-removed-for-windows-mobile-65/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

