<?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; keyboard</title>
	<atom:link href="http://www.hjgode.de/wp/tag/keyboard/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>KeyWedge: Updated</title>
		<link>http://www.hjgode.de/wp/2011/11/10/keywedge-updated/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=keywedge-updated</link>
		<comments>http://www.hjgode.de/wp/2011/11/10/keywedge-updated/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 14:45:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[KeyWedge]]></category>
		<category><![CDATA[wedge]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1233</guid>
		<description><![CDATA[Hello at KeyWedge I posted my code that connects to a serial port and then simulates keystrokes into your application. Now, there were issues where the reconnect did not automatically take place after a Suspend/Resume and you had to invoke the main window and select File-Hide just to let KeyWedge reconnect. This happens on devices [...]]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>at <a title="KeyWede Post" href="http://www.hjgode.de/wp/2009/10/22/keywedge-a-serial-port-to-keyboard-message-connector/">KeyWedge </a>I posted my code that connects to a serial port and then simulates keystrokes into your application.</p>
<p>Now, there were issues where the reconnect did not automatically take place after a Suspend/Resume and you had to invoke the main window and select File-Hide just to let KeyWedge reconnect. This happens on devices that provide the communication port all the time and dont close it during a suspend.</p>
<p>I have added some code to watch the Windows Mobile Power Message Queue for RESUM messages and then do an automatic reconnect. The other option would have been to send some data thru the port periodically to check if it is still working. But this may disturb the attached the device.</p>
<p>The main change is in PowerMsgQueue.cpp. It implements the msg queue to receive power broadcast messages like done in a MSDN example code. If a resume message is encountered, the code sends a WM_USER message to the main window, which will do a SuspendComm/ResumeComm cycle. Very easy.</p>
<p>In PowerMsgQueue.cpp we have code that recognizes the resume:</p>
<pre lang="cpp">                case PBT_TRANSITION:
                    nclog(L"Power Notification Message: PBT_TRANSITION\n");
                    //Add2Log(L"Power Notification Message: PBT_TRANSITION\n",TRUE);
                    nclog(L"Flags: %lx\n", ppb-&gt;Flags);
                    nclog(L"Length: %d\n", ppb-&gt;Length);
                    wsprintf(szPBtype, L"trans.: ");
/*
Flags: 12010000
Length: 6
trans.: ON|PASSWORD|BACKLIGHTON|
*/
                    if(ppb-&gt;Flags &amp; 0x12010000)
                    {
                        nclog(L"PwrMsgQueue: got 'ON|PASSWORD|BACKLIGHTON'...\n");
                        //send a message to main window
                        iPost = PostMessage(hwndMain, WM_USER_RESUMECOMM, 0, 0);
                        nclog(L"PostMessage WM_USER_RESUMECOMM returned %i\n", iPost);
                    }
                    break; 

                case PBT_RESUME:
                    nclog(L"Power Notification Message: PBT_RESUME\n");
                    //Add2Log(L"Power Notification Message: PBT_RESUME\n",TRUE);
                    wsprintf(szPBtype, L"resume: ");
                    //send a message to main window
                    iPost = PostMessage(hwndMain, WM_USER_RESUMECOMM, 0, 0);
                    nclog(L"PostMessage WM_USER_RESUMECOMM returned %i\n", iPost);
                    nclog(L"Power: PBT_RESUME\n");
                    break;</pre>
<p>To not block the queue, I use PostMessage to inform the main window of the Resume. Here is the simple code block in WndProc of the main window:</p>
<p><span id="more-1233"></span></p>
<pre lang="cpp">        case WM_USER_RESUMECOMM: //will be called from bg thread after suspend/resume
            nclog(L"WndProc: received WM_USER_RESUMECOMM: restarting COMM\n");
            suspendCOMM();
            Sleep(100);
            resumeCOMM(); //suspend is called in MYMSG_TASKBARNOTIFY
            break;</pre>
<p>The msgQueue thread is created in InitInstance of the main window:</p>
<pre lang="cpp">    //create PowerResume watchdog thread
    hwndMain=hWnd;
    if(startMsgThread()==0)
        nclog(L"InitInstance: startMsgThread() OK\r\n");
    else
        nclog(L"InitInstance: startMsgThread() FAILED\r\n");

    //helps
    resumeCOMM();

    ShowWindow(hWnd, SW_HIDE);//nCmdShow);
    UpdateWindow(hWnd);</pre>
<p>Have fun coding</p>
<p>Josef</p>
<p>VS2008 WM6 SDK Project: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=145" title="Downloaded 34 times">KeyWedge 2</a> -  (Hits: 34, size: 682.7 kB)</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2011%2F11%2F10%2Fkeywedge-updated%2F&amp;title=KeyWedge%3A+Updated" 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%2F11%2F10%2Fkeywedge-updated%2F&amp;title=KeyWedge%3A+Updated" 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%2F11%2F10%2Fkeywedge-updated%2F&amp;title=KeyWedge%3A+Updated" 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%2F11%2F10%2Fkeywedge-updated%2F&amp;T=KeyWedge%3A+Updated" 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%2F11%2F10%2Fkeywedge-updated%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%2F11%2F10%2Fkeywedge-updated%2F&amp;t=KeyWedge%3A+Updated" 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/11/10/keywedge-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KeyToggleStart: Yet another usage for keyboard hook</title>
		<link>http://www.hjgode.de/wp/2011/09/08/keytogglestart-yet-another-usage-for-keyboard-hook/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=keytogglestart-yet-another-usage-for-keyboard-hook</link>
		<comments>http://www.hjgode.de/wp/2011/09/08/keytogglestart-yet-another-usage-for-keyboard-hook/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 10:56:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[function keys]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1204</guid>
		<description><![CDATA[Hello Windows Mobile Users recently the following was requested: How can I start an application by just hitting some keys in sequence? The answer: Just use a keyboard hook. So I started to code this hook tool based on my KeyToggleBoot2 code. There was not too much to change. The new tool is called KeyToggleStart [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Windows Mobile Users</p>
<p>recently the following was requested:</p>
<p>How can I start an application by just hitting some keys in sequence?</p>
<p>The answer: Just use a keyboard hook.</p>
<p>So I started to code this hook tool based on my KeyToggleBoot2 code. There was not too much to change. The new tool is called KeyToggleStart and it is configured by the registry:</p>
<pre>            REGEDIT4

            [HKEY_LOCAL_MACHINE\Software\Intermec\KeyToggleStart]
            "ForbiddenKeys"=hex:\
                  72 73 00
            ;max 10 keys!
            "KeySeq"="123"
            "Timeout"=dword:00000003
            "LEDid"=dword:00000001
            "Exe"="\\Windows\\iexplore.exe"
            "Arg"=""</pre>
<h2>Reg keys meaning:</h2>
<p><strong>Forbiddenkeys</strong> is just an addon feature: key codes entered in this list will not be processed any more by your Windows Mobile device. For example, to disable the use of the F3(VK_TTALK) and F4 (VK_TEND) keys you have to enter a binary list of 0&#215;72,0&#215;73,0&#215;00 (the zero is needed to terminate the list).</p>
<p><strong>KeySeq</strong> list the char sequence you want to use to start an application. For example if this is the string &#8220;123&#8243;, everytime you enter 123 in sequence within the given time, the application defined will be started.</p>
<p><strong>TimeOut</strong> is the time in seconds you have to enter the sequence. So do not use a long key sequence as &#8220;starteiexplorenow&#8221; and a short timeout (except you are a very fast type writer). The timeout is started with the first char matching and ends after the time or when you enter a non-matching char of the sequence.</p>
<p>With <strong>LEDid</strong> you can specify a LED index number. LED&#8217;s on Windows Mobile are controlled by an index number, each LED has one or more ID assigned to it. So, with LEDid you can control, which LED will lit, when the matching process is running. You can even find an ID to control a vibration motor, if your Windows Mobile device is equipped with one.</p>
<p>The <strong>Exe</strong> registry string value is used to specify which application will be started when the key sequence is matched.</p>
<p>If the application you want have to be started needs some arguments, you can enter these using the <strong>Arg</strong> registry value.</p>
<p>When you start the KeyToggleStart tool, you will not see any window except for a notification symbol on your Start/Home screen of the device.</p>
<p><a href="http://www.hjgode.de/wp/2011/09/08/keytogglestart-yet-another-usage-for-keyboard-hook/keytogglestart/" rel="attachment wp-att-1205"><img class="alignnone size-medium wp-image-1205" title="KeyToggleStart" src="http://www.hjgode.de/wp/wp-content/uploads/2011/09/KeyToggleStart-225x300.png" alt="" width="225" height="300" /></a></p>
<p>If you tap this icon (redirection sign) you have the chance to end the hook tool.</p>
<p><span id="more-1204"></span>The code itself is nothing special. Only the sequence matching code is a little bit special. As the chars in the sequence do not match keystrokes in a ont-to-one manner, I have to check the shift state of the keyboard and if the current char of the seqeunce is a char needing a shift. For example: the asterisk char (&#8220;*&#8221;) is a combination of the &#8220;8&#8243; key plus the Shift key. So, if you have the &#8220;*&#8221; in the char sequence, the code has to check for the &#8220;8&#8243; key and if the keyboard is in shift state:</p>
<pre lang="cpp">// The command below tells the OS that this EXE has an export function so we can use the global hook without a DLL
__declspec(dllexport) LRESULT CALLBACK g_LLKeyboardHookCallback(
   int nCode,      // The hook code
   WPARAM wParam,  // The window message (WM_KEYUP, WM_KEYDOWN, etc.)
   LPARAM lParam   // A pointer to a struct with information about the pressed key
)
{
    /*    typedef struct {
        DWORD vkCode;
        DWORD scanCode;
        DWORD flags;
        DWORD time;
        ULONG_PTR dwExtraInfo;
    } KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;*/

    // Get out of hooks ASAP; no modal dialogs or CPU-intensive processes!
    // UI code really should be elsewhere, but this is just a test/prototype app
    // In my limited testing, HC_ACTION is the only value nCode is ever set to in CE
    static int iActOn = HC_ACTION;
    static bool isShifted=false;

#ifdef DEBUG
    static TCHAR str[MAX_PATH];
#endif

    PKBDLLHOOKSTRUCT pkbhData = (PKBDLLHOOKSTRUCT)lParam;
    //DWORD vKey;
    if (nCode == iActOn)
    {
        //only process unflagged keys
        if (pkbhData-&gt;flags != 0x00)
            return CallNextHookEx(g_hInstalledLLKBDhook, nCode, wParam, lParam);
        //check vkCode against forbidden key list
        if(pForbiddenKeyList!=NULL)
        {
            BOOL bForbidden=false;
            int j=0;
            do{
                if(pForbiddenKeyList[j]==(BYTE)pkbhData-&gt;vkCode)
                {
                    bForbidden=true;
                    DEBUGMSG(1, (L"suppressing forbidden key: 0x%0x\n",pkbhData-&gt;vkCode));
                    continue;
                }
                j++;
            }while(!bForbidden &amp;&amp; pForbiddenKeyList[j]!=0x00);
            if(bForbidden){
                return true;
            }
        }

        SHORT sShifted = GetAsyncKeyState(VK_SHIFT);
        if((sShifted &amp; 0x800) == 0x800)
            isShifted = true;
        else
            isShifted = false;

        //check and toggle for Shft Key
        //do not process shift key
        if (pkbhData-&gt;vkCode == VK_SHIFT){
            DEBUGMSG(1, (L"Ignoring VK_SHIFT\n"));
            return CallNextHookEx(g_hInstalledLLKBDhook, nCode, wParam, lParam);
        }

        //################################################################
        //check if the actual key is a match key including the shift state
        if ((byte)pkbhData-&gt;vkCode == (byte)szVKeySeq[iMatched]){
            DEBUGMSG(1 , (L"==== char match\n"));
            if (bCharShiftSeq[iMatched] == isShifted){
                DEBUGMSG(1 , (L"==== shift match\n"));
            }
            else{
                DEBUGMSG(1 , (L"==== shift not match\n"));
            }
        }

        if( wParam == WM_KEYUP ){
            DEBUGMSG(1, (L"---&gt; szVKeySeq[iMatched] = 0x%02x\n", (byte)szVKeySeq[iMatched]));

            if ( ((byte)pkbhData-&gt;vkCode == (byte)szVKeySeq[iMatched]) &amp;&amp; (isShifted == bCharShiftSeq[iMatched]) ) {

                //the first match?
                if(iMatched==0){
                    //start the timer and lit the LED
                    LedOn(LEDid,1);
                    tID=SetTimer(NULL, 0, matchTimeout, (TIMERPROC)Timer2Proc);
                }
                iMatched++;

                DEBUGMSG(1, (L"iMatched is now=%i\n", iMatched));
                //are all keys matched
                if (iMatched == iKeyCount){
                    //show modeless dialog
                    DEBUGMSG(1, (L"FULL MATCH, starting ...\n"));
                    PostMessage(g_hWnd, WM_SHOWMYDIALOG, 0, 0);
                    //reset match pos and stop timer
                    DEBUGMSG(1, (L"FULL MATCH: Reset matching\n"));
                    LedOn(LEDid,0);
                    iMatched=0; //reset match pos
                    KillTimer(NULL, tID);
                    //return CallNextHookEx(g_hInstalledLLKBDhook, nCode, wParam, lParam);
                }
                //return -1; //do not forward key?
            }
            else
            {
                KillTimer(NULL, tID);
                LedOn(LEDid,0);
                iMatched=0; //reset match pos
                DEBUGMSG(1, (L"FULL MATCH missed. Reseting matching\n"));
            }
        } //if wParam == WM_KEY..
    }
    return CallNextHookEx(g_hInstalledLLKBDhook, nCode, wParam, lParam);
}</pre>
<p>Enjoy the code</p>
<p>Download VS2008 Source code for Windows Mobile 6.5.3 SDK<br />
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=143" title="Downloaded 90 times">KeyToggleStart</a> -  (Hits: 90, size: 30.06 kB)</p>
<p>Download KeyToggleStart executable (Windows Mobile 6)<br />
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=144" title="Downloaded 78 times">KeyToggleStart WM6 Executable</a> -  (Hits: 78, size: 12.38 kB)</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2011%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%2F&amp;title=KeyToggleStart%3A+Yet+another+usage+for+keyboard+hook" 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%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%2F&amp;title=KeyToggleStart%3A+Yet+another+usage+for+keyboard+hook" 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%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%2F&amp;title=KeyToggleStart%3A+Yet+another+usage+for+keyboard+hook" 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%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%2F&amp;T=KeyToggleStart%3A+Yet+another+usage+for+keyboard+hook" 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%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%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%2F09%2F08%2Fkeytogglestart-yet-another-usage-for-keyboard-hook%2F&amp;t=KeyToggleStart%3A+Yet+another+usage+for+keyboard+hook" 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/09/08/keytogglestart-yet-another-usage-for-keyboard-hook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ITCKeyboard: a class to manage ITC keyboard mappings</title>
		<link>http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=itckeyboard-a-class-to-manage-itc-keyboard-mappings</link>
		<comments>http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 06:36:41 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Intermec]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[remap]]></category>
		<category><![CDATA[remapping keys]]></category>
		<category><![CDATA[usb keyboard]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=877</guid>
		<description><![CDATA[A class to manage remapping of usb and direct keys on intermec mobile computers.]]></description>
			<content:encoded><![CDATA[<p>Although Intermec provides a control panel and an API to remap keys for Intermec Mobile Computers these tools only support normal remappings. This means for example you can remap a hardware key to produce a virtual key code. But you cannot map a key to the other great possibilities of the keyboard driver:</p>
<ul>
<li>switch the keyboard plane (shiftkey)</li>
<li>map as modifier key</li>
<li>map as rotate key (one that produce abc depending on how often you press is)</li>
<li>multikey that produces a sequence of key strokes</li>
<li>event key, one that fires a named event pair (like the scan button does)</li>
<li>a function key that executes a function inside a DLL </li>
</ul>
<p>I also added classes to manage the used tables as for example MultiKeys, ShiftKeys, RotateKeys, ModifierKeys and so on.</p>
<p>As an example on how the the USB codes are layed out on a device. Unfortunately I only have mappings of this device and not for the others. Therefor you can only suggest the key to remap by the printing on the key.</p>
<p><a rel="attachment wp-att-878" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/ck61-keyboard/"><img class="alignnone size-full wp-image-878" title="ck61-keyboard" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/ck61-keyboard.bmp" alt="" width="234" height="300" /></a></p>
<p>There is no support in the Intermec tools to remap directKeys. For example the side buttons of a CN3 or CN4 or the PTT button of the CK3 are not managed via the usb keyboard driver, these are managed by a direct keyboard driver. ITCKEYBOARD enables you to remap this keys thru an API.</p>
<p><span id="more-877"></span>The ITCKEYBOARD namespace and the CUsbKeys and CDirectKeys classes are still in development and I started a google code project to invite you to collaborate. You are free to download and use the classes, the code is released under GPL v3 license. As this is a project in development, there is no warranty for anything.</p>
<p>The other reason I started to use googlecode was to get familar with a version control system. So forgive me, if I do or did something wrong with svn.</p>
<p>The classes are documented inline and an offline documentation is generated with Doxygen. On my windows developer PC I use AnkhSVN and on an Ubuntu PC (documentation only) I use the svn command line tool. On Windows you may also use TortoiseSVN, which integrates into the file explorer whereas AnkhSVN integrates into Visual Studio.</p>
<p>Both keyboard driver mappings are controlled thru the registry of the intermec device (see community.intermec.com for a doc called <a title="Reprogramming the USB keypad" href="http://community.intermec.com/t5/General-Development-Developer/Keypad-remap/m-p/84#M24" target="_blank">reprogramming the usb keypad</a>). The ITCKEYBOARD namespace provides you managed, strongly typed access to these registry tables. For example the USB keyboard mappings are controlled by a sequence of 6 bytes for every key. These bytes define the key function and are concatenated in the registry into one binary registry value. The ITCKEYBOARD classes take this binary value and splits it into the single key sequences for easy managing.</p>
<h2>Screenshots of a small Demo</h2>
<h3>The demo start and DirectKeys screen</h3>
<p><a rel="attachment wp-att-881" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/demostart/"><img class="alignnone size-medium wp-image-881" title="DemoStart" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/DemoStart-225x300.gif" alt="" width="225" height="300" /> </a><a rel="attachment wp-att-879" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/demodirectkeys/"><img class="alignnone size-medium wp-image-879" title="DemoDirectKeys" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/DemoDirectKeys-225x300.gif" alt="" width="225" height="300" /></a></p>
<h3>DirectKey event management and USBKey demo form</h3>
<p><a rel="attachment wp-att-880" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/demodirectkeysevents/"><img class="alignnone size-medium wp-image-880" title="DemoDirectKeysEvents" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/DemoDirectKeysEvents-225x300.gif" alt="" width="225" height="300" /></a> <a rel="attachment wp-att-882" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/demousbkeys/"><img class="alignnone size-medium wp-image-882" title="DemoUSBkeys" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/DemoUSBkeys-225x300.gif" alt="" width="225" height="300" /></a></p>
<h3>In insight view with the dumpscreen</h3>
<p><a rel="attachment wp-att-883" href="http://www.hjgode.de/wp/2010/11/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/demousbkeysdump/"><img class="alignnone size-medium wp-image-883" title="DemoUSBkeysDump" src="http://www.hjgode.de/wp/wp-content/uploads/2010/11/DemoUSBkeysDump-225x300.gif" alt="" width="225" height="300" /></a></p>
<h2>Sample usage</h2>
<pre escaped="true" line="1" lang="csharp">            //create a new, empty usbkey
            CUSBkeys.usbKeyStruct _theKey = new CUSBkeys.usbKeyStruct();
            _theKey.bHID = 0x07;
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.NoRepeat;// UsbKeyFlags2.NoRepeat;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.RotateKeyIndex;// UsbKeyFlags3.RotateKeyIndex;

            //initialize a new usbkey object
            CUSBkeys _cusb = new CUSBkeys();

            //ShiftPlane 1 ####################################################
            //CAPS lock on "1"
            // 'ModKey2' = 00,02,08,58 //caps lock
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.NoRepeat;// UsbKeyFlags2.NoRepeat;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.ModifierIndex;// UsbKeyFlags3.ModifierIndex;
            _theKey.bIntScan = 0x02; //ModKey index at 2 is caps lock
            _theKey.bScanKey =  (CUsbKeyTypes.HWkeys)0x1E;
            if (_cusb.setKey(2, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(2, _theKey);

            //space on "0"
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.VKEY;// UsbKeyFlags2.VKEY;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.NormalKey;// UsbKeyFlags3.NormalKey;
            _theKey.bIntScan = 0x20;
            _theKey.bScanKey = (CUsbKeyTypes.HWkeys)0x27;
            if (_cusb.setKey(2, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(2, _theKey);

            //remap (OK) to "@" (Shifted-Space)
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.VKEY | CUsbKeyTypes.usbFlagsMid.Shifted;// UsbKeyFlags2.Shifted;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.NormalKey;// UsbKeyFlags3.NormalKey;
            _theKey.bIntScan = 0x32;
            _theKey.bScanKey = CUsbKeyTypes.HWkeys.Right_GUI;
            if (_cusb.setKey(2, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(2, _theKey);

            //ShiftPlane 1 ####################################################
            //VKLWIN='Left GUI' on "0", 07,27,00,01,00,1F (07,E3,00,01,00,1F)
            //remap "0" on shift plane 1 to VK_LWIN (windows key)
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.Extended;// UsbKeyFlags2.Extended;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.NormalKey;// UsbKeyFlags3.NormalKey;
            _theKey.bIntScan = 0x1F;
            _theKey.bScanKey = (CUsbKeyTypes.HWkeys)0x27;
            if (_cusb.setKey(1, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(1, _theKey);

            //change the top row of keys to F1 to F4
            _theKey.bHID = 0x07;
            _theKey.bScanKey = CUsbKeyTypes.HWkeys.Left_GUI;
            _theKey.bFlagHigh = CUsbKeyTypes.usbFlagsHigh.NoFlag;// UsbKeyFlags3.NoFlag;
            _theKey.bFlagMid = CUsbKeyTypes.usbFlagsMid.VKEY;// UsbKeyFlags2.VKEY;
            _theKey.bFlagLow = CUsbKeyTypes.usbFlagsLow.NormalKey;// UsbKeyFlags3.NormalKey;
            _theKey.bIntScan = 0x70; //F1
            if (_cusb.setKey(0, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(0, _theKey);

            _theKey.bScanKey = CUsbKeyTypes.HWkeys.F1;
            _theKey.bIntScan = (byte)VKEY.VK_PRIOR;//PageUp // 0x71; //F2
            if (_cusb.setKey(0, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(0, _theKey);

            _theKey.bScanKey = CUsbKeyTypes.HWkeys.F2;
            _theKey.bIntScan = (byte)VKEY.VK_NEXT;//PgDwn 0x72; //F3
            if (_cusb.setKey(0, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(0, _theKey);

            _theKey.bScanKey = CUsbKeyTypes.HWkeys.Right_GUI;
            _theKey.bIntScan = 0x73; //F3
            if (_cusb.setKey(0, _theKey.bScanKey, _theKey) != 0)
                _cusb.addKey(0, _theKey);

            _cusb.writeKeyTables(); //save the changes

            // DIRECT Keys stuff
            //remap PTT to @
            CDirectKeys _directKeys = new CDirectKeys(); //create a new directkey object
            _directKeys.setKey(0x02, VKEY.VK_SPACE, CDirectKeys.directKeyType.kTypeShiftdVirtualKey);
            _directKeys.saveKeyTable(); //save the changes
            _directKeys = null;
</pre>
<p>Source Code (Visual Studio 2005, Windows Mobile 6 Prof. SDK). (Work in progress)<br />
 <a class="linkification-ext" title="Linkification: http://code.google.com/p/itc-keyboard/" href="http://code.google.com/p/itc-keyboard/">http://code.google.com/p/itc-keyboard/</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F11%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%2F&amp;title=ITCKeyboard%3A+a+class+to+manage+ITC+keyboard+mappings" 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%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%2F&amp;title=ITCKeyboard%3A+a+class+to+manage+ITC+keyboard+mappings" 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%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%2F&amp;title=ITCKeyboard%3A+a+class+to+manage+ITC+keyboard+mappings" 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%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%2F&amp;T=ITCKeyboard%3A+a+class+to+manage+ITC+keyboard+mappings" 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%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%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%2F06%2Fitckeyboard-a-class-to-manage-itc-keyboard-mappings%2F&amp;t=ITCKeyboard%3A+a+class+to+manage+ITC+keyboard+mappings" 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/06/itckeyboard-a-class-to-manage-itc-keyboard-mappings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>keyToggleChar &#8211; a tool to enter UTF-8 national chars via keyboard</title>
		<link>http://www.hjgode.de/wp/2010/07/19/keytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=keytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard</link>
		<comments>http://www.hjgode.de/wp/2010/07/19/keytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 11:28:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[GetForegroundKeyboardTarget]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[keytogglechar]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=713</guid>
		<description><![CDATA[As you may know my keyToggle app to be able to use the number keys on a windows mobile device as function keys, here is another one that enables you to enter special national chars, like Å, Ä Æ etc. directly via the keyboard. You must specify 10 keys and there UTF-8 replacements. Configuration is done [...]]]></description>
			<content:encoded><![CDATA[<p>As you may know my keyToggle app to be able to use the number keys on a windows mobile device as function keys, here is another one that enables you to enter special national chars, like Å, Ä Æ etc. directly via the keyboard. You must specify 10 keys and there UTF-8 replacements. Configuration is done via the registry:</p>
<pre>3.0        added code for read/write reg for CharTable and KeyTable
 REGEDIT4

 [HKEY_LOCAL_MACHINE\Software\Intermec\KeyToggleChar]
 "KeyTable"=hex:\
 30,31,32,33,34,35,36,37,38,39
 "CharTable"=hex:\
 C6,00,E6,00,D8,00,F8,00,C5,00,E5,00,C2,00,E2,00,C4,00,E4,00
 "LEDid"=dword:00000001
 "autoFallback"=dword:00000000
 "Timeout"=dword:00000003
 "StickyKey"=dword:00000074

 <strong>KeyTable</strong>     holds a list of 10 keys which will be 'remapped'
 <strong>CharTable </strong>   holds  list of UniChar codes to use as replacement
 <strong>LEDid </strong>       defines the ID of the LED to use for showing sticky state
 <strong>autoFallback </strong>defines, if the sticky state is reset after a mapped key is pressed.
              Use 0, if you dont want the sticky state to fallback after keypress
 <strong>TimeOut </strong>     defines a timout after which sticky state will be reset</pre>
<p>To get the UTF-8 word entries for Unicode chars, see for example here: http://www.unicode.org/charts/charindex.html</p>
<p>The default mapping used here is defined as follows and maps the keys 0-9 to:</p>
<pre>0x00c6, 0x00e6, 0x00d8, 0x00f8, 0x00C5, 0x00e5, 0x00c2, 0x00e2, 0x00c4, 0x00e4
 AE        ae     O/       o/      A°      a°      A^      a^      Ä       ä</pre>
<p>The main problem I had was finding a function to get the window handle of the current input active window. Finally I found GetForegroundKeyboardTarget() (after some days of searching).</p>
<p><span id="more-713"></span></p>
<pre escaped="true" lang="c">void sendKey(UINT vKey){
 TCHAR* lpText;
 lpText = new TCHAR[MAX_PATH];
 TCHAR strClass[MAX_PATH];
 int iRes;

 // hWndActive = GetFocusEx(); // a trick that does not deliver the focusses window
 hWndActive = GetForegroundKeyboardTarget();

 GetWindowText(hWndActive, lpText, MAX_PATH-1);
 iRes = GetClassName(hWndActive, strClass, MAX_PATH);
 DEBUGMSG(1, (L"### GetFocusEx() window, handle=0x%x, text='%s', class='%s'\n", hWndActive, lpText, strClass));

 if(hWndActive == NULL)
 return; //no window found

 WPARAM wParam = getCharForKey(vKey); // charTable[vKey-0x30];// 0x00c6; //AE
 LPARAM lParam = 1; //flags: repeat=1

/*
 wm_keydown, wParam=0, lParam=1
 wm_char, wParam=char code, lParam=1
 wm_keyup, wParam=0, lParam=c0000001;
*/

 LRESULT lRes=0;
 lRes = SendMessage(hWndActive, WM_KEYDOWN, 0, 1);
 DEBUGMSG(1, (L"SendMessage1 for 'WM_KEYDOWN' returned 0x%0x\n", lRes));
 lRes = SendMessage(hWndActive, WM_CHAR, wParam, 1);
 DEBUGMSG(1, (L"SendMessage2 for '0x%04x' returned 0x%0x\n", wParam, lRes));
 lRes = SendMessage(hWndActive, WM_KEYUP, 0, 0xc0000001);
 DEBUGMSG(1, (L"SendMessage3 for 'WM_KEYUP' returned 0x%0x\n", lRes));

 return;
}</pre>
<p>I leaved my different finding in code (commented out), so you can see, what functions I have tried. <br class="spacer_" /></p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=108" title="Downloaded 159 times">keyToggleChar</a> -  (Hits: 159, size: 6 kB)
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=109" title="Downloaded 153 times">keyToggleChar Source (C/C++, VS2005, Mobile 6 SDK)</a> -  (Hits: 153, size: 35.92 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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%2F&amp;title=keyToggleChar+%26%238211%3B+a+tool+to+enter+UTF-8+national+chars+via+keyboard" 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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%2F&amp;title=keyToggleChar+%26%238211%3B+a+tool+to+enter+UTF-8+national+chars+via+keyboard" 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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%2F&amp;title=keyToggleChar+%26%238211%3B+a+tool+to+enter+UTF-8+national+chars+via+keyboard" 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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%2F&amp;T=keyToggleChar+%26%238211%3B+a+tool+to+enter+UTF-8+national+chars+via+keyboard" 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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%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%2F07%2F19%2Fkeytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard%2F&amp;t=keyToggleChar+%26%238211%3B+a+tool+to+enter+UTF-8+national+chars+via+keyboard" 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/07/19/keytogglechar-a-tool-to-enter-utf-8-national-chars-via-keyboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Development: Hooking the keyboard &#8211; KeyToggle</title>
		<link>http://www.hjgode.de/wp/2010/07/16/mobile-development-hooking-the-keyboard-keytoggle/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-hooking-the-keyboard-keytoggle</link>
		<comments>http://www.hjgode.de/wp/2010/07/16/mobile-development-hooking-the-keyboard-keytoggle/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 04:02:33 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Int*rm*c]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[function keys]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[simulate keys]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=675</guid>
		<description><![CDATA[Using keyboard hook to remap keys to function keys on windows mobile.]]></description>
			<content:encoded><![CDATA[<p><strong>KeyToggle</strong></p>
<p>Extend your keyboard to get function keys by pressing numbers.</p>
<p>With keytoggle you can define a &#8216;sticky&#8217; key that will change the beahviour of the number keys. As long as the sticky key is &#8216;active&#8217;, number keys from 1 to 0 will produce the function keys F1 to F10. If sticky key is active, the left LED will light in green.</p>
<p>To start keytoggle just tap it or let it start by a link in StartUp. If keytoggle is loaded, you can see a small yellow arrow sign in the taskbar.</p>
<p><a rel="attachment wp-att-676" href="http://www.hjgode.de/wp/2010/07/16/mobile-development-hooking-the-keyboard-keytoggle/keytoggle-3/"><img class="alignnone size-full wp-image-676" title="keytoggle" src="http://www.hjgode.de/wp/wp-content/uploads/2010/07/keytoggle.gif" alt="" width="23" height="24" /></a></p>
<p>If you tap this symbol, you are asked, if you want to unload the app. If the registry does not have values defined for keytoggle, it will use default values. If you try to launch keytoggle a second time you will get a message box. Only one instance of keytoggle can run at a time.</p>
<p>Using the registry you can define the behaviour of the sticky key. In example, you can have the sticky key remain active until it is pressed again, let it &#8216;go off&#8217; or &#8216;fallback&#8217; after a period of time or let it fallback after a number key has been pressed. If the sticky key is pressed again, it will always fallback.</p>
<p><span id="more-675"></span>REGEDIT4<br />
 [HKEY<em>LOCAL</em>MACHINE\SOFTWARE\Intermec\KeyToggle]<br />
 &#8220;Timeout&#8221;=dword:00000000<br />
 &#8220;autoFallback&#8221;=dword:00000001<br />
 &#8220;StickyKey&#8221;=dword:00000090</p>
<p>The values:</p>
<pre><code>  StickyKey:
  default "144", decimal (VK_NUMLOCK)
  the VK_ value of the sticky key. Here you define, what you will have as the sticky key. VK_ values are defined as in winuser.h. In example the VK_ value for the NumLock key is 0x90 (144 decimal, see VK_NUMLOCK). The sticky key will be consumed by keytoggle and is not visible to the system any more. That means, that you should choose key value that you do not need in any app you use.

  Timeout:
  default "3", three seconds
  number of seconds the sticky key will remain active. If 0, the sticky key will not fallback automatically by time

  autoFallback:
  default "0"
  if 0 the sticky key will not fallback after pressing a number key. If 1 the sticky key will fallback after a number key is pressed
</code></pre>
<p><strong>Launch arguments</strong></p>
<pre><code>  Keytoggle only supports one argument: "-writereg". This will create the registry keys used by keytoggle and fill them with the default values.
</code></pre>
<p><strong>Usage Sample Scenario</strong></p>
<p>You have a ITC Color device  with a numeric keyboard but no function keys. You need the function keys to be able to use a web application within iBrowse. With keytoggle you can now for example use the Gold key as sticky key. You have to download the device reource kit to get a keyboard remapper tool from the ITC site and assign the Gold key to NUMLOCK.</p>
<p><a rel="attachment wp-att-677" href="http://www.hjgode.de/wp/2010/07/16/mobile-development-hooking-the-keyboard-keytoggle/cpkbdmap-3/"><img class="alignnone size-medium wp-image-677" title="cpkbdmap" src="http://www.hjgode.de/wp/wp-content/uploads/2010/07/cpkbdmap-225x300.gif" alt="" width="225" height="300" /></a></p>
<p>With this remapping and keytoggle running you will to get a function keystroke simulated if you press the Gold key and then a number key.</p>
<p>Download installer: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=107" title="Downloaded 194 times">KeyToggle Installer CAB</a> -  (Hits: 194, size: 5.19 kB)</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2010%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%2F&amp;title=Mobile+Development%3A+Hooking+the+keyboard+%26%238211%3B+KeyToggle" 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%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%2F&amp;title=Mobile+Development%3A+Hooking+the+keyboard+%26%238211%3B+KeyToggle" 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%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%2F&amp;title=Mobile+Development%3A+Hooking+the+keyboard+%26%238211%3B+KeyToggle" 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%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%2F&amp;T=Mobile+Development%3A+Hooking+the+keyboard+%26%238211%3B+KeyToggle" 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%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%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%2F07%2F16%2Fmobile-development-hooking-the-keyboard-keytoggle%2F&amp;t=Mobile+Development%3A+Hooking+the+keyboard+%26%238211%3B+KeyToggle" 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/07/16/mobile-development-hooking-the-keyboard-keytoggle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hooking the keyboard message queue in compact framework code</title>
		<link>http://www.hjgode.de/wp/2009/12/04/hooking-the-keyboard-message-queue-in-compact-framework-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hooking-the-keyboard-message-queue-in-compact-framework-code</link>
		<comments>http://www.hjgode.de/wp/2009/12/04/hooking-the-keyboard-message-queue-in-compact-framework-code/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 21:26:03 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cf2]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[hooking]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[queue]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=240</guid>
		<description><![CDATA[Hooking the keyboard message queue in CF2]]></description>
			<content:encoded><![CDATA[<p>Here is some nice code to use a keyboard hook implemented in C# for compact framework.</p>
<p>You can use this to catch the funny OS asigned keys like F1, F2, F3, F4, F6 and F7 (Softkey 1 and 2, Phone, End, Volume Up, Volume Down); and last but not least catch the Win Key press.</p>
<p><span id="more-240"></span>The hooking class:</p>
<pre lang="csharp">using System;
using System.Runtime.InteropServices;
/*
In order to use this class in your program, just declare the varialble and hook up into HookEvent:
HookKeys hook = new HookKeys();
hook.HookEvent += new HookKeys.HookEventHandler(HookEvent);
hook.Start();
*/
public class HookKeys
{
#region delegates
    public delegate int HookProc(int code, IntPtr wParam, IntPtr lParam);
    public delegate void HookEventHandler(HookEventArgs e, KeyBoardInfo keyBoardInfo);
    public HookEventHandler HookEvent;
#endregion
#region fields
    private HookProc hookDeleg;
    private static int hHook = 0;
#endregion

    public HookKeys()
    {
    }
    ~HookKeys(){
        if(hHook!=0)
            this.Stop();
    }
    #region public methods
    ///
    /// Starts the hook
    ///
    public void Start()
    {
        if (hHook != 0)
        {
            //Unhook the previouse one
            this.Stop();
        }
        hookDeleg = new HookProc(HookProcedure);
        hHook = SetWindowsHookEx(WH_KEYBOARD_LL, hookDeleg, GetModuleHandle(null), 0);
        if (hHook == 0)
        {
            throw new SystemException("Failed acquiring of the hook.");
        }
        AllKeys(true);
    }
    ///
    /// Stops the hook
    ///
    public void Stop()
    {
        UnhookWindowsHookEx(hHook);
        AllKeys(false);
    }
    #endregion
    #region protected and private methods
    protected virtual void OnHookEvent(HookEventArgs hookArgs, KeyBoardInfo keyBoardInfo)
    {
        if (HookEvent != null)
        {
            HookEvent(hookArgs, keyBoardInfo);
        }
    }

    private int HookProcedure(int code, IntPtr wParam, IntPtr lParam)
    {
       KBDLLHOOKSTRUCT hookStruct =  (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT));
       if (code &lt; 0)
            return CallNextHookEx(hookDeleg, code, wParam, lParam);
       // Let clients determine what to do
       HookEventArgs e = new HookEventArgs();
       e.Code = code;
       e.wParam = wParam;
       e.lParam = lParam;
       KeyBoardInfo keyInfo = new KeyBoardInfo();
       keyInfo.vkCode = hookStruct.vkCode;
       keyInfo.scanCode = hookStruct.scanCode;
       OnHookEvent(e, keyInfo);
       // Yield to the next hook in the chain
       return CallNextHookEx(hookDeleg, code, wParam, lParam);
   }
   #endregion
   #region P/Invoke declarations

   [DllImport("coredll.dll")]
   private static extern int AllKeys(bool bEnable);

   [DllImport("coredll.dll")]
   private static extern int SetWindowsHookEx(int type, HookProc hookProc, IntPtr hInstance, int m);
   [DllImport("coredll.dll")]
   private static extern IntPtr GetModuleHandle(string mod);
   [DllImport("coredll.dll")]
   private static extern int CallNextHookEx(
           HookProc hhk,
           int nCode,
           IntPtr wParam,
           IntPtr lParam
           );
   [DllImport("coredll.dll")]
   private static extern int GetCurrentThreadId();
   [DllImport("coredll.dll", SetLastError = true)]
   private static extern int UnhookWindowsHookEx(int idHook);
   private struct KBDLLHOOKSTRUCT
   {
       public int vkCode;
       public int scanCode;
       public int flags;
       public int time;
       public IntPtr dwExtraInfo;
   }
   const int WH_KEYBOARD_LL = 20;
   #endregion
}
#region event arguments

    public class HookEventArgs : EventArgs
    {
        public int Code;    // Hook code
        public IntPtr wParam;   // WPARAM argument
        public IntPtr lParam;   // LPARAM argument
    }
    public class KeyBoardInfo
    {
        public int vkCode;
        public int scanCode;
        public int flags;
        public int time;
    }
#endregion
</pre>
<p>Here is the download of the Visual Studio 2005 Windows Mobile 6 SDK targeting source code:</p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=46" title="Downloaded 1025 times">KbdHookCS</a> - Keyboard hooking in compact framework (Hits: 1025, size: 31.69 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%2F2009%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%2F&amp;title=Hooking+the+keyboard+message+queue+in+compact+framework+code" 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%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%2F&amp;title=Hooking+the+keyboard+message+queue+in+compact+framework+code" 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%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%2F&amp;title=Hooking+the+keyboard+message+queue+in+compact+framework+code" 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%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%2F&amp;T=Hooking+the+keyboard+message+queue+in+compact+framework+code" 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%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%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%2F12%2F04%2Fhooking-the-keyboard-message-queue-in-compact-framework-code%2F&amp;t=Hooking+the+keyboard+message+queue+in+compact+framework+code" 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/12/04/hooking-the-keyboard-message-queue-in-compact-framework-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>USBkey: keyboard remapping from cmd line (ITC only)</title>
		<link>http://www.hjgode.de/wp/2009/06/30/usbkey-keyboard-remapping-from-cmd-line-itc-only/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=usbkey-keyboard-remapping-from-cmd-line-itc-only</link>
		<comments>http://www.hjgode.de/wp/2009/06/30/usbkey-keyboard-remapping-from-cmd-line-itc-only/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 08:52:29 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[CN3]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[remap]]></category>
		<category><![CDATA[remapping]]></category>
		<category><![CDATA[USBkey]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=171</guid>
		<description><![CDATA[remap usb keyboard of ITC devices]]></description>
			<content:encoded><![CDATA[<p>A simple keyboard remapper command line tool for devices having a USB keypad (CN3, CK61, CV30, CK3).</p>
<p>The ITC devices use a USB keyboard driver. You can remap keys of the keypad using the keby remapper tool from the Device Resource Kit. Unfortunately not all possible assignments are available with this remapper tool, so I wrote a tool that gives you full control. Be careful when using.</p>
<h2><span id="more-171"></span>Usage</h2>
<p>no args no work</p>
<pre>usbkey restore 0</pre>
<p style="padding-left: 30px;">restore keytable shiftplane numbered 0</p>
<p style="padding-left: 30px;">i.e. a CK3 numPad has 3 shiftplanes (0 to 2), with this command you can restore the original layout of a shiftplane.</p>
<pre>usbkey dump</pre>
<p style="padding-left: 30px;">this will dump the actual shiftplanes into a file: \usbkey.txt</p>
<p style="padding-left: 30px;">usbkey setNOOP 0 &#8220;Left gui&#8221;</p>
<p style="padding-left: 30px;">this will set the NOOP flag for the matching PS/2 key &#8220;Left Gui&#8221;, which is the windows key. This disables the Windows key. PS2 keynames here are not case sensitive.</p>
<pre>usbkey setNOOP 0 "1"</pre>
<p style="padding-left: 30px;">this will disable (NOOP = No Operation) of the 1 key in plane 0.</p>
<pre>usbkey resetNOOP 0 "Left GUI"</pre>
<p style="padding-left: 30px;">this will restore (unset) the NOOP flag for key &#8220;Left GUI&#8221; in plane 0.</p>
<pre>usbkey setPS2key 0 "1" "2"</pre>
<p style="padding-left: 30px;">setPS2key iPlane szOldKey szNewKey<br />
will change key assigned to &#8217;1&#8242; to produce a &#8217;2&#8242;</p>
<p>you can use the usb hex code of a key to specify the OldKey. You have to prefix the hex code by SCX (not case sensitive). In example:</p>
<pre><span style="font-weight: bold;">usbkey setPS2key 1 scx0x1E F1</span></pre>
<p style="padding-left: 30px;">will set the key with usb scancode 0x1e in plane 1 to produce a F1</p>
<p>Since version 1.1, usbkey supports remapping of keys to point to <strong>ModifiersKeys</strong>:</p>
<p>To map F3 to the Caps modifier key, use this:</p>
<pre>usbkey setKey2Mod 0 "F3" "Caps"</pre>
<p>To map F4 to the Alt modifier key, use this:</p>
<pre>usbkey setKey2Mod 0 "F4" "Alt"</pre>
<p>The output of dump has been extended to show ModifiersKeys and Keys, that are not mapped to a PS2 key now are listed with there pointer. In example:</p>
<pre>iUSBkey[30] hex: 0x0C,0xE9,0x00,0x02,0x01,0x01	CodePage:0x0C, ScanCode:0xE9, 'SHIFTKEY INDEX-&gt;1'</pre>
<p>says: key with USB scancode 0xE9 is mapped as ShiftKey (dont see this as Shifted Key, &#8216;ShiftKey&#8217; is used here as indicator for keys that change the shift plane).</p>
<h3>General</h3>
<p>Quotes are only needed around arguments containing spaces.<br />
SCX syntax to specify key to change using USB code in hex can be used for setNoop, ResetNoop, SetKey2Mod and setPS2key. To get a list of available USB scan codes use the dump command argument: &#8216;usbkey dump&#8217;. The second byte is the USB scanCode to use.</p>
<p>In example:</p>
<pre>
    iUSBkey[8] hex: 0x07,0x22,0x00,0x00,0x00,0x2E    ... 'keyName='5'
                           ^
                           This is the entry for USB scancode: 0x22
                           The PS2 code created here is 0x2E,

                           which will produce '5'</pre>
<p>If you specify one of the implicit VKEY values (F13 to F24) as newKey, you must specify the correct spelled name. Example: &#8216;setPS2key 0 scX0x1e F13&#8242; &#8211; the F13 will be looked up in aPS2 table which says, this is a VKEY and then the tool will look in the VKEY table and look for &#8216;VK_F13&#8242; to get the scancode.</p>
<h3>Remarks</h3>
<p>USBkey uses a table to search against a given keyname string. This search is using the number of characters specified and is not case sensitive actually. This means, if you specify only &#8220;Left&#8221; as keyname, the tool will use the first found &#8216;left&#8217; from a table, this may result in finding the entry for &#8216;Left Arrow&#8217; or &#8216;Left GUI&#8217; or anything else that I have in my keyname table starting with &#8216;left&#8217;. Here is the actual keyname table (PS2).</p>
<pre>
//UNASSIGNED replaced by 0xffff
//RESERVED   replaced by 0xAAAA
//NONE       replaced by 0xFFFE
//UNDEFINED  replaced by 0xFFFD
//vkey = 0xFFFA
//extended is 0xE0__

//"Key Name"	, HID Usage Page	, HID Usage ID	, PS/2 Set
usbPageUsageID usbPageUsageIDs[] = {
    {L"System Power", 0x01, 0x81, 0xE037},
    {L"System Sleep", 0x01, 0x82, 0xE03F},
    {L"System Wake", 0x01, 0x83, 0xE05E},
    {L"No Event", 0x07, 0x00, 0xFFFE},
    {L"Overrun Error", 0x07, 0x01, 0x00},
    {L"POST Fail", 0x07, 0x02, 0xFC},
    {L"Error Undefined", 0x07, 0x03, 0xFFFF},
    {L"a A", 0x07, 0x04, 0x1C},
    {L"b B", 0x07, 0x05, 0x32},
    {L"c C", 0x07, 0x06, 0x21},
    {L"d D", 0x07, 0x07, 0x23},
    {L"e E", 0x07, 0x08, 0x24},
    {L"f F", 0x07, 0x09, 0x2B},
    {L"g G", 0x07, 0x0A, 0x34},
    {L"h H", 0x07, 0x0B, 0x33},
    {L"i I", 0x07, 0x0C, 0x43},
    {L"j J", 0x07, 0x0D, 0x3B},
    {L"k K", 0x07, 0x0E, 0x42},
    {L"l L", 0x07, 0x0F, 0x4B},
    {L"m M", 0x07, 0x10, 0x3A},
    {L"n N", 0x07, 0x11, 0x31},
    {L"o O", 0x07, 0x12, 0x44},
    {L"p P", 0x07, 0x13, 0x4D},
    {L"q Q", 0x07, 0x14, 0x15},
    {L"r R", 0x07, 0x15, 0x2D},
    {L"s S", 0x07, 0x16, 0x1B},
    {L"t T", 0x07, 0x17, 0x2C},
    {L"u U", 0x07, 0x18, 0x3C},
    {L"v V", 0x07, 0x19, 0x2A},
    {L"w W", 0x07, 0x1A, 0x1D},
    {L"x X", 0x07, 0x1B, 0x22},
    {L"y Y", 0x07, 0x1C, 0x35},
    {L"z Z", 0x07, 0x1D, 0x1A},
    {L"1 !", 0x07, 0x1E, 0x16},
    {L"2 @", 0x07, 0x1F, 0x1E},
    {L"3 #", 0x07, 0x20, 0x26},
    {L"4 $", 0x07, 0x21, 0x25},
    {L"5 %%", 0x07, 0x22, 0x2E},
    {L"6 ^", 0x07, 0x23, 0x36},
    {L"7 &amp;", 0x07, 0x24, 0x3D},
    {L"8 *", 0x07, 0x25, 0x3E},
    {L"9 (", 0x07, 0x26, 0x46},
    {L"0 )", 0x07, 0x27, 0x45},
    {L"Return", 0x07, 0x28, 0x5A},
    {L"Escape", 0x07, 0x29, 0x76},
    {L"Backspace", 0x07, 0x2A, 0x66},
    {L"Tab", 0x07, 0x2B, 0x0D},
    {L"Space", 0x07, 0x2C, 0x29},
    {L"-_", 0x07, 0x2D, 0x4E},
    {L"= +", 0x07, 0x2E, 0x55},
    {L"[ {L", 0x07, 0x2F, 0x54},
    {L"] }", 0x07, 0x30, 0x5B},
    {L"\\ |", 0x07, 0x31, 0x5D},
    {L"Europe 1", 0x07, 0x32, 0x5D},
    {L"; :", 0x07, 0x33, 0x4C},
    {L"‘ \"", 0x07, 0x34, 0x52},
    {L"` ~", 0x07, 0x35, 0x0E},
    {L", &lt;", 0x07, 0x36, 0x41},
    {L". &gt;", 0x07, 0x37, 0x49},
    {L"/ ?", 0x07, 0x38, 0x4A},
    {L"Caps Lock", 0x07, 0x39, 0x58},
    {L"F1", 0x07, 0x3A, 0x05},
    {L"F2", 0x07, 0x3B, 0x06},
    {L"F3", 0x07, 0x3C, 0x04},
    {L"F4", 0x07, 0x3D, 0x0C},
    {L"F5", 0x07, 0x3E, 0x03},
    {L"F6", 0x07, 0x3F, 0x0B},
    {L"F7", 0x07, 0x40, 0x83},
    {L"F8", 0x07, 0x41, 0x0A},
    {L"F9", 0x07, 0x42, 0x01},
    {L"F10", 0x07, 0x43, 0x09},
    {L"F11", 0x07, 0x44, 0x78},
    {L"F12", 0x07, 0x45, 0x07},
    {L"Print Screen", 0x07, 0x46, 0xE07C},
    {L"Scroll Lock", 0x07, 0x47, 0x7E},
    {L"Break", 0x07, 0x48, 0xE07E},
    {L"Pause", 0x07, 0x48, 0xfffD},
    {L"Insert", 0x07, 0x49, 0xE070},
    {L"Home", 0x07, 0x4A, 0xE06C},
    {L"Page Up", 0x07, 0x4B, 0xE07D},
    {L"Delete", 0x07, 0x4C, 0xE071},
    {L"End", 0x07, 0x4D, 0xE069},
    {L"Page Down", 0x07, 0x4E, 0xE07A},
    {L"Right Arrow", 0x07, 0x4F, 0xE074},
    {L"Left Arrow", 0x07, 0x50, 0xE06B},
    {L"Down Arrow", 0x07, 0x51, 0xE072},
    {L"Up Arrow", 0x07, 0x52, 0xE075},
    {L"Num Lock", 0x07, 0x53, 0x77},
    {L"Keypad /", 0x07, 0x54, 0xE04A},
    {L"Keypad *", 0x07, 0x55, 0xE07C},
    {L"Keypad -", 0x07, 0x56, 0xE07B},
    {L"Keypad +", 0x07, 0x57, 0x79},
    {L"Keypad Enter", 0x07, 0x58, 0xE05A},
    {L"Keypad 1", 0x07, 0x59, 0x69},
    {L"Keypad 2", 0x07, 0x5A, 0x72},
    {L"Keypad 3", 0x07, 0x5B, 0x7A},
    {L"Keypad 4", 0x07, 0x5C, 0x79},
    {L"Keypad 5", 0x07, 0x5D, 0x73},
    {L"Keypad 6", 0x07, 0x5E, 0x74},
    {L"Keypad 7", 0x07, 0x5F, 0x6C},
    {L"Keypad 8", 0x07, 0x60, 0x75},
    {L"Keypad 9", 0x07, 0x61, 0x7D},
    {L"Keypad 0", 0x07, 0x62, 0x70},
    {L"Keypad .", 0x07, 0x63, 0x71},
    {L"Europe 2", 0x07, 0x64, 0x61},
    {L"App", 0x07, 0x65, 0xE02F},
    {L"Keyboard Power", 0x07, 0x66, 0xE037},
    {L"Keypad =", 0x07, 0x67, 0x0F},
    {L"F13", 0x07, 0x68, 0xFFFA},
    {L"F14", 0x07, 0x69, 0xFFFA},
    {L"F15", 0x07, 0x6A, 0xFFFA},
    {L"F16", 0x07, 0x6B, 0xFFFA},
    {L"F17", 0x07, 0x6C, 0xFFFA},
    {L"F18", 0x07, 0x6D, 0xFFFA},
    {L"F19", 0x07, 0x6E, 0xFFFA},
    {L"F20", 0x07, 0x6F, 0xFFFA},
    {L"F21", 0x07, 0x70, 0xFFFA},
    {L"F22", 0x07, 0x71, 0xFFFA},
    {L"F23", 0x07, 0x72, 0xFFFA},
    {L"F24", 0x07, 0x73, 0xFFFA},
    {L"Keyboard Execute", 0x07, 0x74, 0xFFFF},
    {L"Keyboard Help", 0x07, 0x75, 0xFFFF},
    {L"Keyboard Menu", 0x07, 0x76, 0xFFFF},
    {L"Keyboard Select", 0x07, 0x77, 0xFFFF},
    {L"Keyboard Stop", 0x07, 0x78, 0xFFFF},
    {L"Keyboard Again", 0x07, 0x79, 0xFFFF},
    {L"Keyboard Undo", 0x07, 0x7A, 0xFFFF},
    {L"Keyboard Cut", 0x07, 0x7B, 0xFFFF},
    {L"Keyboard Copy", 0x07, 0x7C, 0xFFFF},
    {L"Keyboard Paste", 0x07, 0x7D, 0xFFFF},
    {L"Keyboard Find", 0x07, 0x7E, 0xFFFF},
    {L"Keyboard Mute", 0x07, 0x7F, 0xFFFF},
    {L"Keyboard Volume Up", 0x07, 0x80, 0xFFFF},
    {L"Keyboard Volume Down", 0x07, 0x81, 0xFFFF},
    {L"Keyboard Locking Caps Lock", 0x07, 0x82, 0xFFFF},
    {L"Keyboard Locking Num Lock", 0x07, 0x83, 0xFFFF},
    {L"Keyboard Locking Scroll Lock", 0x07, 0x84, 0xFFFF},
    {L"Keypad ,", 0x07, 0x85, 0xFFFF},
    {L"Keyboard Equal Sign", 0x07, 0x86, 0xFFFF},
    {L"Keyboard Int’l 1", 0x07, 0x87, 0xFFFF},
    {L"Keyboard Int’l 2", 0x07, 0x88, 0xFFFF},
    {L"Keyboard Int’l 3", 0x07, 0x89, 0xFFFF},
    {L"Keyboard Int’l 4", 0x07, 0x8A, 0xFFFF},
    {L"Keyboard Int’l 5", 0x07, 0x8B, 0xFFFF},
    {L"Keyboard Int’l 6", 0x07, 0x8C, 0xFFFF},
    {L"Keyboard Int’l 7", 0x07, 0x8D, 0xFFFF},
    {L"Keyboard Int’l 8", 0x07, 0x8E, 0xFFFF},
    {L"Keyboard Int’l 9", 0x07, 0x8F, 0xFFFF},
    {L"Keyboard Lang 1", 0x07, 0x90, 0xFFFF},
    {L"Keyboard Lang 2", 0x07, 0x91, 0xFFFF},
    {L"Keyboard Lang 3", 0x07, 0x92, 0xFFFF},
    {L"Keyboard Lang 4", 0x07, 0x93, 0xFFFF},
    {L"Keyboard Lang 5", 0x07, 0x94, 0xFFFF},
    {L"Keyboard Lang 6", 0x07, 0x95, 0xFFFF},
    {L"Keyboard Lang 7", 0x07, 0x96, 0xFFFF},
    {L"Keyboard Lang 8", 0x07, 0x97, 0xFFFF},
    {L"Keyboard Lang 9", 0x07, 0x98, 0xFFFF},
    {L"Keyboard Alternate Erase", 0x07, 0x99, 0xFFFF},
    {L"Keyboard SysReq/Attention", 0x07, 0x9A, 0xFFFF},
    {L"Keyboard Cancel", 0x07, 0x9B, 0xFFFF},
    {L"Keyboard Clear", 0x07, 0x9C, 0xFFFF},
    {L"Keyboard Prior", 0x07, 0x9D, 0xFFFF},
    {L"Keyboard Return", 0x07, 0x9E, 0xFFFF},
    {L"Keyboard Separator", 0x07, 0x9F, 0xFFFF},
    {L"Keyboard Out", 0x07, 0xA0, 0xFFFF},
    {L"Keyboard Oper", 0x07, 0xA1, 0xFFFF},
    {L"Keyboard Clear/Again", 0x07, 0xA2, 0xFFFF},
    {L"Keyboard CrSel/Props", 0x07, 0xA3, 0xFFFF},
    {L"Keyboard ExSel", 0x07, 0xA4, 0xFFFF},
    {L"RESERVED", 0x07, 0xA5, 0xAAAA},
    //
    {L"RESERVED", 0x07, 0xDF, 0xAAAA},
    {L"Left Control", 0x07, 0xE0, 0x14},
    {L"Left Shift", 0x07, 0xE1, 0x12},
    {L"Left Alt", 0x07, 0xE2, 0x11},
    {L"Left GUI", 0x07, 0xE3, 0xE01F},
    {L"Right Control", 0x07, 0xE4, 0xE014},
    {L"Right Shift", 0x07, 0xE5, 0x59},
    {L"Right Alt", 0x07, 0xE6, 0xE011},
    {L"Right GUI", 0x07, 0xE7, 0xE027},
    {L"RESERVED", 0x07, 0xE8, 0xAAAA},
	{L"RESERVED", 0x07, 0xFFFF, 0xAAAA},
	{NULL, 0x00, 0x00, 0x00} //last marker
};</pre>
<h2>Sample Dump</h2>
<p>Here is a sample of the USB HID scan codes of a ITC device.</p>
<h3>Warning</h3>
<p>the 62h, 61h, 05h, 71h and 52h keys at the top are NOT part of the USB keypad, they are direct keys (see my post about DirectKeyUI):</p>
<p><img class="alignnone size-full wp-image-172" title="CK61num_scancodes" src="http://www.hjgode.de/wp/wp-content/uploads/2009/06/CK61num_scancodes.jpeg" alt="CK61num_scancodes" width="323" height="446" /></p>
<p>Unfortunately, I dont have these mappings for all devices and keypads and so you have to evaluate the dump files, to find the right scan codes.</p>
<p>Here is a sample of usbkey.txt of a CN3 with numeric phone style keypad:</p>
<pre>
######## dump of plane 0 ###########
iUSBkey[0] hex: 0x07,0x00,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x00, KeyName:'No Event'
iUSBkey[1] hex: 0x07,0x01,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x01, KeyName:'Overrun Error'
iUSBkey[2] hex: 0x07,0x02,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x02, KeyName:'POST Fail'
iUSBkey[3] hex: 0x07,0x03,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x03, KeyName:'Error Undefined'
iUSBkey[4] hex: 0x07,0x1E,0x00,0x00,0x00,0x16	CodePage:0x07, ScanCode:0x1E, KeyName:'1 !'
iUSBkey[5] hex: 0x07,0x1F,0x00,0x00,0x00,0x1E	CodePage:0x07, ScanCode:0x1F, KeyName:'2 @'
iUSBkey[6] hex: 0x07,0x20,0x00,0x00,0x00,0x26	CodePage:0x07, ScanCode:0x20, KeyName:'3 #'
iUSBkey[7] hex: 0x07,0x21,0x00,0x00,0x00,0x25	CodePage:0x07, ScanCode:0x21, KeyName:'4 $'
iUSBkey[8] hex: 0x07,0x22,0x00,0x00,0x00,0x2E	CodePage:0x07, ScanCode:0x22, KeyName:'5 %%'
iUSBkey[9] hex: 0x07,0x23,0x00,0x00,0x00,0x36	CodePage:0x07, ScanCode:0x23, KeyName:'6 ^'
iUSBkey[10] hex: 0x07,0x24,0x00,0x00,0x00,0x3D	CodePage:0x07, ScanCode:0x24, KeyName:'7 &amp;'
iUSBkey[11] hex: 0x07,0x25,0x00,0x00,0x00,0x3E	CodePage:0x07, ScanCode:0x25, KeyName:'8 *'
iUSBkey[12] hex: 0x07,0x26,0x00,0x00,0x00,0x46	CodePage:0x07, ScanCode:0x26, KeyName:'9 ('
iUSBkey[13] hex: 0x07,0x27,0x00,0x00,0x00,0x45	CodePage:0x07, ScanCode:0x27, KeyName:'0 )'
iUSBkey[14] hex: 0x07,0x28,0x00,0x00,0x00,0x5A	CodePage:0x07, ScanCode:0x28, KeyName:'Return'
iUSBkey[15] hex: 0x07,0x29,0x00,0x00,0x00,0x76	CodePage:0x07, ScanCode:0x29, KeyName:'Escape'
iUSBkey[16] hex: 0x07,0x2A,0x00,0x00,0x00,0x66	CodePage:0x07, ScanCode:0x2A, KeyName:'Backspace'
iUSBkey[17] hex: 0x07,0x2B,0x00,0x00,0x00,0x0D	CodePage:0x07, ScanCode:0x2B, KeyName:'Tab'
iUSBkey[18] hex: 0x07,0x37,0x00,0x00,0x00,0x49	CodePage:0x07, ScanCode:0x37, KeyName:'. &gt;'
iUSBkey[19] hex: 0x07,0x41,0x00,0x20,0x00,0x3E	CodePage:0x07, ScanCode:0x41, KeyName:'F8'
iUSBkey[20] hex: 0x07,0x42,0x00,0x20,0x00,0x26	CodePage:0x07, ScanCode:0x42, KeyName:'F9'
iUSBkey[21] hex: 0x07,0x51,0x00,0x01,0x00,0x72	CodePage:0x07, ScanCode:0x51, KeyName:'Down Arrow'
iUSBkey[22] hex: 0x07,0x52,0x00,0x01,0x00,0x75	CodePage:0x07, ScanCode:0x52, KeyName:'Up Arrow'
iUSBkey[23] hex: 0x07,0xE3,0x00,0x01,0x00,0x1F	CodePage:0x07, ScanCode:0xE3, KeyName:'Left GUI'
iUSBkey[24] hex: 0x07,0x3A,0x00,0x00,0x00,0x05	CodePage:0x07, ScanCode:0x3A, KeyName:'F1'
iUSBkey[25] hex: 0x07,0x3B,0x00,0x00,0x00,0x06	CodePage:0x07, ScanCode:0x3B, KeyName:'F2'
iUSBkey[26] hex: 0x07,0x3C,0x00,0x00,0x00,0x04	CodePage:0x07, ScanCode:0x3C, KeyName:'F3'
iUSBkey[27] hex: 0x07,0x3D,0x00,0x00,0x00,0x0C	CodePage:0x07, ScanCode:0x3D, KeyName:'F4'
iUSBkey[28] hex: 0x07,0x8B,0x00,0x02,0x01,0x02	CodePage:0x07, ScanCode:0x8B, KeyName:'Keyboard Int’l 5'
iUSBkey[29] hex: 0x07,0x90,0x00,0x02,0x02,0x01	CodePage:0x07, ScanCode:0x90, KeyName:'Keyboard Lang 1'
iUSBkey[30] hex: 0x0C,0xE9,0x00,0x02,0x01,0x01	CodePage:0x0C, ScanCode:0xE9, KeyName:'undefined'
--------------------------------------
######## dump of plane 1 ###########
iUSBkey[0] hex: 0x07,0x00,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x00, KeyName:'No Event'
iUSBkey[1] hex: 0x07,0x01,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x01, KeyName:'Overrun Error'
iUSBkey[2] hex: 0x07,0x02,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x02, KeyName:'POST Fail'
iUSBkey[3] hex: 0x07,0x03,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x03, KeyName:'Error Undefined'
iUSBkey[4] hex: 0x07,0x1E,0x00,0x00,0x00,0x05	CodePage:0x07, ScanCode:0x1E, KeyName:'1 !'
iUSBkey[5] hex: 0x07,0x1F,0x00,0x00,0x00,0x1E	CodePage:0x07, ScanCode:0x1F, KeyName:'2 @'
iUSBkey[6] hex: 0x07,0x20,0x00,0x00,0x00,0x06	CodePage:0x07, ScanCode:0x20, KeyName:'3 #'
iUSBkey[7] hex: 0x07,0x21,0x00,0x00,0x00,0x25	CodePage:0x07, ScanCode:0x21, KeyName:'4 $'
iUSBkey[8] hex: 0x07,0x22,0x00,0x00,0x00,0x2E	CodePage:0x07, ScanCode:0x22, KeyName:'5 %%'
iUSBkey[9] hex: 0x07,0x23,0x00,0x00,0x00,0x36	CodePage:0x07, ScanCode:0x23, KeyName:'6 ^'
iUSBkey[10] hex: 0x07,0x24,0x00,0x00,0x00,0x3D	CodePage:0x07, ScanCode:0x24, KeyName:'7 &amp;'
iUSBkey[11] hex: 0x07,0x25,0x00,0x00,0x00,0x3E	CodePage:0x07, ScanCode:0x25, KeyName:'8 *'
iUSBkey[12] hex: 0x07,0x26,0x00,0x00,0x00,0x46	CodePage:0x07, ScanCode:0x26, KeyName:'9 ('
iUSBkey[13] hex: 0x07,0x27,0x00,0x00,0x00,0x45	CodePage:0x07, ScanCode:0x27, KeyName:'0 )'
iUSBkey[14] hex: 0x07,0x28,0x00,0x00,0x00,0x5A	CodePage:0x07, ScanCode:0x28, KeyName:'Return'
iUSBkey[15] hex: 0x07,0x29,0x00,0x02,0x04,0x02	CodePage:0x07, ScanCode:0x29, KeyName:'Escape'
iUSBkey[16] hex: 0x07,0x2A,0x00,0x00,0x00,0x66	CodePage:0x07, ScanCode:0x2A, KeyName:'Backspace'
iUSBkey[17] hex: 0x07,0x2B,0x00,0x00,0x04,0x03	CodePage:0x07, ScanCode:0x2B, KeyName:'Tab'
iUSBkey[18] hex: 0x07,0x37,0x00,0x02,0x02,0x03	CodePage:0x07, ScanCode:0x37, KeyName:'. &gt;'
iUSBkey[19] hex: 0x07,0x41,0x00,0x00,0x00,0x4E	CodePage:0x07, ScanCode:0x41, KeyName:'F8'
iUSBkey[20] hex: 0x07,0x42,0x00,0x20,0x00,0x55	CodePage:0x07, ScanCode:0x42, KeyName:'F9'
iUSBkey[21] hex: 0x07,0x51,0x00,0x01,0x00,0x74	CodePage:0x07, ScanCode:0x51, KeyName:'Down Arrow'
iUSBkey[22] hex: 0x07,0x52,0x00,0x01,0x00,0x6B	CodePage:0x07, ScanCode:0x52, KeyName:'Up Arrow'
iUSBkey[23] hex: 0x07,0xE3,0x00,0x10,0x00,0x1F	CodePage:0x07, ScanCode:0xE3, KeyName:'Left GUI'
iUSBkey[24] hex: 0x07,0x3C,0x00,0x00,0x00,0x04	CodePage:0x07, ScanCode:0x3C, KeyName:'F3'
iUSBkey[25] hex: 0x07,0x3D,0x00,0x00,0x00,0x0C	CodePage:0x07, ScanCode:0x3D, KeyName:'F4'
iUSBkey[26] hex: 0x07,0x8B,0x00,0x02,0x01,0x02	CodePage:0x07, ScanCode:0x8B, KeyName:'Keyboard Int’l 5'
iUSBkey[27] hex: 0x07,0x90,0x00,0x02,0x02,0x01	CodePage:0x07, ScanCode:0x90, KeyName:'Keyboard Lang 1'
iUSBkey[28] hex: 0x0C,0xE9,0x00,0x02,0x01,0x01	CodePage:0x0C, ScanCode:0xE9, KeyName:'undefined'
--------------------------------------
######## dump of plane 2 ###########
iUSBkey[0] hex: 0x07,0x00,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x00, KeyName:'No Event'
iUSBkey[1] hex: 0x07,0x01,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x01, KeyName:'Overrun Error'
iUSBkey[2] hex: 0x07,0x02,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x02, KeyName:'POST Fail'
iUSBkey[3] hex: 0x07,0x03,0x00,0x00,0x00,0x00	CodePage:0x07, ScanCode:0x03, KeyName:'Error Undefined'
iUSBkey[4] hex: 0x07,0x1E,0x00,0x00,0x08,0x04	CodePage:0x07, ScanCode:0x1E, KeyName:'1 !'
iUSBkey[5] hex: 0x07,0x1F,0x00,0x02,0x40,0x01	CodePage:0x07, ScanCode:0x1F, KeyName:'2 @'
iUSBkey[6] hex: 0x07,0x20,0x00,0x02,0x40,0x02	CodePage:0x07, ScanCode:0x20, KeyName:'3 #'
iUSBkey[7] hex: 0x07,0x21,0x00,0x02,0x40,0x03	CodePage:0x07, ScanCode:0x21, KeyName:'4 $'
iUSBkey[8] hex: 0x07,0x22,0x00,0x02,0x40,0x04	CodePage:0x07, ScanCode:0x22, KeyName:'5 %%'
iUSBkey[9] hex: 0x07,0x23,0x00,0x02,0x40,0x05	CodePage:0x07, ScanCode:0x23, KeyName:'6 ^'
iUSBkey[10] hex: 0x07,0x24,0x00,0x02,0x40,0x06	CodePage:0x07, ScanCode:0x24, KeyName:'7 &amp;'
iUSBkey[11] hex: 0x07,0x25,0x00,0x02,0x40,0x07	CodePage:0x07, ScanCode:0x25, KeyName:'8 *'
iUSBkey[12] hex: 0x07,0x26,0x00,0x02,0x40,0x08	CodePage:0x07, ScanCode:0x26, KeyName:'9 ('
iUSBkey[13] hex: 0x07,0x27,0x00,0x00,0x00,0x29	CodePage:0x07, ScanCode:0x27, KeyName:'0 )'
iUSBkey[14] hex: 0x07,0x28,0x00,0x00,0x00,0x5A	CodePage:0x07, ScanCode:0x28, KeyName:'Return'
iUSBkey[15] hex: 0x07,0x29,0x00,0x00,0x00,0x76	CodePage:0x07, ScanCode:0x29, KeyName:'Escape'
iUSBkey[16] hex: 0x07,0x2A,0x00,0x00,0x00,0x66	CodePage:0x07, ScanCode:0x2A, KeyName:'Backspace'
iUSBkey[17] hex: 0x07,0x2B,0x00,0x00,0x00,0x0D	CodePage:0x07, ScanCode:0x2B, KeyName:'Tab'
iUSBkey[18] hex: 0x07,0x37,0x00,0x00,0x00,0x49	CodePage:0x07, ScanCode:0x37, KeyName:'. &gt;'
iUSBkey[19] hex: 0x07,0x41,0x00,0x20,0x00,0x3E	CodePage:0x07, ScanCode:0x41, KeyName:'F8'
iUSBkey[20] hex: 0x07,0x42,0x00,0x20,0x00,0x26	CodePage:0x07, ScanCode:0x42, KeyName:'F9'
iUSBkey[21] hex: 0x07,0x51,0x00,0x01,0x00,0x74	CodePage:0x07, ScanCode:0x51, KeyName:'Down Arrow'
iUSBkey[22] hex: 0x07,0x52,0x00,0x01,0x00,0x6B	CodePage:0x07, ScanCode:0x52, KeyName:'Up Arrow'
iUSBkey[23] hex: 0x07,0xE3,0x00,0x10,0x00,0x1F	CodePage:0x07, ScanCode:0xE3, KeyName:'Left GUI'
iUSBkey[24] hex: 0x07,0x3C,0x00,0x00,0x00,0x04	CodePage:0x07, ScanCode:0x3C, KeyName:'F3'
iUSBkey[25] hex: 0x07,0x3D,0x00,0x00,0x00,0x0C	CodePage:0x07, ScanCode:0x3D, KeyName:'F4'
iUSBkey[26] hex: 0x07,0x8B,0x00,0x02,0x01,0x02	CodePage:0x07, ScanCode:0x8B, KeyName:'Keyboard Int’l 5'
iUSBkey[27] hex: 0x07,0x90,0x00,0x02,0x02,0x01	CodePage:0x07, ScanCode:0x90, KeyName:'Keyboard Lang 1'
iUSBkey[28] hex: 0x0C,0xE9,0x00,0x02,0x01,0x01	CodePage:0x0C, ScanCode:0xE9, KeyName:'undefined'
--------------------------------------</pre>
<p>See also readme.txt and sample dump included in attached file</p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=26" title="Downloaded 419 times">USBkey</a> -  (Hits: 419, size: 67.6 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%2F2009%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%2F&amp;title=USBkey%3A+keyboard+remapping+from+cmd+line+%28ITC+only%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%2F2009%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%2F&amp;title=USBkey%3A+keyboard+remapping+from+cmd+line+%28ITC+only%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%2F2009%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%2F&amp;title=USBkey%3A+keyboard+remapping+from+cmd+line+%28ITC+only%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%2F2009%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%2F&amp;T=USBkey%3A+keyboard+remapping+from+cmd+line+%28ITC+only%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%2F2009%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%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%2F06%2F30%2Fusbkey-keyboard-remapping-from-cmd-line-itc-only%2F&amp;t=USBkey%3A+keyboard+remapping+from+cmd+line+%28ITC+only%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/2009/06/30/usbkey-keyboard-remapping-from-cmd-line-itc-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Control the green and orange keyboard shift planes on ITC device</title>
		<link>http://www.hjgode.de/wp/2009/06/26/control-the-green-and-orange-keyboard-shift-planes-on-itc-device/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=control-the-green-and-orange-keyboard-shift-planes-on-itc-device</link>
		<comments>http://www.hjgode.de/wp/2009/06/26/control-the-green-and-orange-keyboard-shift-planes-on-itc-device/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 13:59:58 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CN3]]></category>
		<category><![CDATA[CN3e]]></category>
		<category><![CDATA[ITC]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[plane]]></category>
		<category><![CDATA[shift]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=158</guid>
		<description><![CDATA[Using the keyboard shift API on ITC handhelds]]></description>
			<content:encoded><![CDATA[<p>Hello</p>
<p>as this is asked from time to tim, here is a sample and a class in C# (VS2005) that enables you to switch the green and orange keyboard shift plane of the keyboards on ITC CN3, CN3e and possibly other ruggedized ITC handheld devices.</p>
<p>You can control the keyboard shift state and you can subscribe to an event to get information about changes in the keyboard shift panel state. With the latter, you can create an application that is always aware of the active keyboard shift plane.</p>
<p><span id="more-158"></span><img class="alignnone size-full wp-image-159" title="KeyboardShiftAPI" src="http://www.hjgode.de/wp/wp-content/uploads/2009/06/KeyboardShiftAPI.jpg" alt="KeyboardShiftAPI" width="741" height="331" /></p>
<p>On the left image you see, that no shift plane is active. In the mid image, the Orange button was pressed. If you had pressed the orange key on the keypad, the Lock mode would be Locked. On the right image the green button was pressed.</p>
<p>As soon as a state change is detected (polling frequency is 200ms), the focus is moved to the right TextBox and the background color of the upper TextBox changes.</p>
<p>The code is written in C# and uses the native WIn32 APIs KernelIOControl, DeviceIOControl and CreateFile. You can either ask the current state of the shift plane and set it directly using the provided static class, or you can use the dynamic class object. The dynamic class fires an event, if the keypad shift panle status changes.</p>
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=20" title="Downloaded 110 times">KeyshiftAPI_cs executable</a> -  (Hits: 110, size: 14 KB)
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=21" title="Downloaded 227 times">KeyboardShiftAPI_CS VS2005 compact framework C# code</a> -  (Hits: 227, size: 79.95 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%2F2009%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%2F&amp;title=Control+the+green+and+orange+keyboard+shift+planes+on+ITC+device" 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%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%2F&amp;title=Control+the+green+and+orange+keyboard+shift+planes+on+ITC+device" 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%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%2F&amp;title=Control+the+green+and+orange+keyboard+shift+planes+on+ITC+device" 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%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%2F&amp;T=Control+the+green+and+orange+keyboard+shift+planes+on+ITC+device" 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%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%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%2F06%2F26%2Fcontrol-the-green-and-orange-keyboard-shift-planes-on-itc-device%2F&amp;t=Control+the+green+and+orange+keyboard+shift+planes+on+ITC+device" 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/06/26/control-the-green-and-orange-keyboard-shift-planes-on-itc-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hooking into the keyboard message queue</title>
		<link>http://www.hjgode.de/wp/2009/05/16/hooking-into-the-keyboard-message-queue/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hooking-into-the-keyboard-message-queue</link>
		<comments>http://www.hjgode.de/wp/2009/05/16/hooking-into-the-keyboard-message-queue/#comments</comments>
		<pubDate>Sat, 16 May 2009 04:59:09 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[iHook]]></category>
		<category><![CDATA[keyb-exe-for-win-ce]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[windows ce]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=52</guid>
		<description><![CDATA[Sample source for windows ce showwing how to use keyboard hooks in windows ce]]></description>
			<content:encoded><![CDATA[<p>Although undocumented keyboard hooking is possible. I read an article at <a title="Using keyboard hooks in windows ce" href="http://www.codeproject.com/KB/mobile/wincekbhook.aspx">CodeProject</a> about hooking and wrote some applications that uses this great possibility. One result is iHook, an application that will do something like the button shortcuts applet in windows mobile. You can define keys and what application they should start.</p>
<h2><a name="iHook2"><span id="more-52"></span>iHook3</a></h2>
<p>This application provides the user with key shortcuts to applications. All keystrokes or hot keys are transparent, this means, they are not lost  and will reach the application just running in foreground. iHook2 can be started  by placing a link to the exe in \Windows\Startup, by a batch file or some other  AutoStart feature of the device OS.</p>
<h2><!--more-->iHook3 Version 1.3</h2>
<p>This versions uses the registry to read the assigned keys and applications.  Additionally the app is now safe and will only load once. The only argument  supported is &#8220;-writereg&#8221; to write a default registry (see below).</p>
<h3>Sample registry:</h3>
<pre>[HKEY_LOCAL_MACHINE\SOFTWARE\Intermec\iHook2]
"arg4"="iRun2.exe"
"exe4"="\\windows\\iKill2.exe"
"key4"=hex:\
      1b
"arg3"=""
"exe3"="explorer.exe"
"key3"=hex:\
      71
"arg2"=""
"exe2"="\\windows\\iSIP2.exe"
"key2"=hex:\
      74
"arg1"="-toggle"
"exe1"="\\windows\\LockTaskBar.exe"
"key1"=hex:\
      73
"arg0"=""
"exe0"="\\windows\\iRotateCN2.exe"
"key0"=hex:\
      72</pre>
<h2><a name="iHook3"></a></h2>
<p><strong>New in version iHook3 (version 2.0)</strong><br />
recognizes CK60<br />
adds Notification icon in taskbar</p>
<p><strong>New in iHook3 (version 3.1)</strong><br />
recognizes CN3<br />
supports consuming/forwarding switch for hot-keys. Use &#8220;ForwardKey&#8221;  registry binary value 0 to disable forwarding hot-keys, 1 to enable forwarding  hotkeys.<br />
This new option is usefull if you have a phone device and hook the number keys.  In this case disable forwarding with 0, otherwise the phone app will come in  front for the number keys.</p>
<pre>REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Intermec\iHook3]
"arg0"=""
"exe0"="\\Windows\\iRotate.exe"
"key0"=hex:\
      26
"<strong>ForwardKey</strong>"=hex:\
      00

<strong>The main functionality is in here:</strong>
#pragma data_seg(".HOOKDATA")									//	Shared data (memory) among all instances.
	HHOOK g_hInstalledLLKBDhook = NULL;						// Handle to low-level keyboard hook
	//HWND hWnd	= NULL;											// If in a DLL, handle to app window receiving WM_USER+n message
#pragma data_seg()

#pragma comment(linker, "/SECTION:.HOOKDATA,RWS")		//linker directive

// The command below tells the OS that this EXE has an export function so we can use the global hook without a DLL
__declspec(dllexport) LRESULT CALLBACK g_LLKeyboardHookCallback(
   int nCode,      // The hook code
   WPARAM wParam,  // The window message (WM_KEYUP, WM_KEYDOWN, etc.)
   LPARAM lParam   // A pointer to a struct with information about the pressed key
)
{
	/*	typedef struct {
	    DWORD vkCode;
	    DWORD scanCode;
	    DWORD flags;
	    DWORD time;
	    ULONG_PTR dwExtraInfo;
	} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;*/

	// Get out of hooks ASAP; no modal dialogs or CPU-intensive processes!
	// UI code really should be elsewhere, but this is just a test/prototype app
	// In my limited testing, HC_ACTION is the only value nCode is ever set to in CE
	static int iActOn = HC_ACTION;
	PROCESS_INFORMATION pi;
	int i;
	bool processed_key=false;
	if (nCode == iActOn)
	{
		PKBDLLHOOKSTRUCT pkbhData = (PKBDLLHOOKSTRUCT)lParam;
		if ( (wParam == WM_KEYUP) &amp;&amp; (processed_key==false) )
		{
			for (i=0; i&lt;=lastKey; i++)
			{
				if (pkbhData-&gt;vkCode == kMap[i].keyCode)
				{

Below is the download of the source code as done with embedded visual c 4.
<b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=6" title="Downloaded 340 times">iHook3 Embedded Visual C++ 4 source code</a> -  (Hits: 340, size: 90.75 KB)</pre>
<!-- 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%2F16%2Fhooking-into-the-keyboard-message-queue%2F&amp;title=Hooking+into+the+keyboard+message+queue" 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%2F16%2Fhooking-into-the-keyboard-message-queue%2F&amp;title=Hooking+into+the+keyboard+message+queue" 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%2F16%2Fhooking-into-the-keyboard-message-queue%2F&amp;title=Hooking+into+the+keyboard+message+queue" 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%2F16%2Fhooking-into-the-keyboard-message-queue%2F&amp;T=Hooking+into+the+keyboard+message+queue" 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%2F16%2Fhooking-into-the-keyboard-message-queue%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%2F16%2Fhooking-into-the-keyboard-message-queue%2F&amp;t=Hooking+into+the+keyboard+message+queue" 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/16/hooking-into-the-keyboard-message-queue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

