Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Remapping Keyboard on Win32

by gryphon (Abbot)
on Mar 23, 2006 at 03:15 UTC ( #538644=perlquestion: print w/ replies, xml ) Need Help??
gryphon has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all,

I recently had wrist surgery on my right wrist to remove a gamglion cyst and other problems with the joint. The surgery was a success, and things are healing well, but I'm stuck in a cast-like thing for at least another two weeks, likely longer. This makes typing with both hands all but impossible. (Yes, I'm typing this message with one hand.) I started Googling and found out about one-handed keyboards like this and this, and that got me thinking: couldn't I just do the same thing with Perl?

I use both Windows and Linux at work and at home, but most of the typing I need to do over the next couple weeks is in Word on Windows, so while I'd love a solution that works on both platforms, I'm biased toward a Win32 solution. I started looking into Win32::API a bit, and then I wandered down the rabbit hole of C# by reading this keyboard hook example. I also searched around on PerlMonks and found code to activate and deactivate the keyboard.

Has anyone else tied this? Am I wandering in the right direction? Is there an easier solution? Thanks very much.

gryphon
Whitepages.com Development Manager (WDDC)
code('Perl') || die;

Comment on Remapping Keyboard on Win32
Re: Remapping Keyboard on Win32
by zentara (Archbishop) on Mar 23, 2006 at 12:33 UTC
Re: Remapping Keyboard on Win32
by gryphon (Abbot) on Mar 24, 2006 at 17:22 UTC

    Greetings all,

    The bad news is that I haven't been able to solve this problem yet. The good news is that my wrist is healing much faster than expected, and I'm now in a smaller splint that frees up my right hand for typing. So I'm abandoning this effort; however, just in case someone else wants to work on this in the future, here's the code I ended up with:

    I primarily used this codefetch.com example along with Win32::API. Although I'm not seeing any errors, I don't think I'm getting the keyboard hook set correctly because $n never increments no matter how many keys I hit while the script runs. The $get_key_state call works just fine, but I can't seem get $callback to get called on keypress. Oh well.

    gryphon
    Whitepages.com Development Manager (WDDC)
    code('Perl') || die;

      Again, in case someone else ends up here, you might want to check out the Scan Code Mapper for Windows. Basically, you add a registry key saying what keys you want to remap. Its simpler than writing anything if your requirements are straightforward. http://www.microsoft.com/whdc/device/input/w2kscan-map.mspx Night

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://538644]
Approved by jfroebe
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-12-28 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls