{"id":275,"date":"2011-10-14T19:30:20","date_gmt":"2011-10-14T19:30:20","guid":{"rendered":"http:\/\/www.griffinscs.com\/blog\/?p=275"},"modified":"2011-10-14T19:30:20","modified_gmt":"2011-10-14T19:30:20","slug":"update-htpc-ir","status":"publish","type":"post","link":"https:\/\/brainslug.azurewebsites.net\/?p=275","title":{"rendered":"Update: HTPC IR&#8230;"},"content":{"rendered":"<p>In <a href=\"\/blog\/?p=247\">my last post<\/a> I talked about some of the remaining issues to solve in my attempt to migrate to a new, inexpensive remote for my HTPC. \u00a0I tend to err on the side of\u00a0over-engineering\u00a0solutions to problems like these and well...this time is no exception. \u00a0My solution consists of a virtual HID shim\/miniport\u00a0driver with an interface to user mode software. \u00a0I wrapped this in a managed \"VirtualKeyboard\" class so I can call it from a service which listens for my remote commands to come in on the eHome Remote Receiver.<\/p>\n<p>The benefits of this approach are twofold over sending out any kind of windows message, which is what every boxed solution I found does. \u00a0First, I can code the entire solution into the service layer. \u00a0Placing this functionality in a service run automatically as LocalSystem allows it to behave like a first-class input device. \u00a0Always available and decoupled from UI.\u00a0 Yes you can inherit NativeWindow, pump and send Windows messages in a service, but I couldn't figure out any way to send a\u00a0key-press\u00a0there. \u00a0Even if I could do it that way I don't think I'd want to.<\/p>\n<p>The second benefit is proper integration with Media Center, and anything else that may require a true device identity. \u00a0In order to support Media Center's 10-key SMS style text entry feature, it needs to be able to\u00a0distinguish\u00a0buttons pressed by a remote, which is modeled as a keyboard device in Windows, and a true keyboard. \u00a0Key-presses\u00a0originating from Windows messages are always handled as keyboard input. \u00a0The distinction between keyboard and remote is made in the registry (\"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Media Center\\Remote Controls\").  The names of the values defined in this key map to hardware ID's to be handled as remotes.<\/p>\n<p>I can see this component being useful with a number of software suites and other automation scenarios. \u00a0IR Server Suite, EventGhost and AutoHotkey come to mind. \u00a0As it is, the service I wrote is special-cased for my remote, but if you have need for such a beast, drop me a line. \u00a0I can likely adapt it to other needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last post I talked about some of the remaining issues to solve in my attempt to migrate to a new, inexpensive remote for my HTPC. \u00a0I tend to err on the side of\u00a0over-engineering\u00a0solutions to problems like these and well&#8230;this time is no exception. \u00a0My solution consists of a virtual HID shim\/miniport\u00a0driver with an [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[7,8,9,18,24,25,26,28,50],"_links":{"self":[{"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts\/275"}],"collection":[{"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=275"}],"version-history":[{"count":0,"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts\/275\/revisions"}],"wp:attachment":[{"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brainslug.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}