[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Can keyboard assignment use Windows key?




Carl,

Many thanks---this sounds like an interesting challenge! I'll see what
I can come up with and report back.


Martin

On 1/8/2011 2:52 AM, Carl Distefano wrote:
Martin:
Can key combinations involving the Windows key (located between Ctrl and Alt on my keyboard) be (re)assigned in a kbd file?
It wouldn't be straight-forward, but in principle it should be doable. You'd have to swap one or both Win keys with a Windows virtual key which generates a key code that XyWrite recognizes *and* that is different from any other key code currently used in your KBD file. (In WinXP you can remap keys by editing the Windows Registry; not sure how it's done in Win7.) The challenge is to find a virtual key that puts out a key code that XyWrite can use. A couple of years ago Robert discovered that XyWrite 4 will recognize key codes 115 and 126, and that these codes are generated by Window virtual keys with hex scan codes C1 and C2, respectively. On my XP Pro machine, I tried swapping in C1 00 and C2 00 for the Win keys 5B E0 and 5C E0. This generated key codes 65 and 66 in XyWrite when the Win keys were pressed and released -- no good). Then I tried swapping in C1 E0 and C2 E0 for the Win keys. These did not generate key codes in XyWrite when the Win keys were pressed and released. At that point, I gave up.
I see how va $kc gets a key code for active keys, but I can't see how to do so for keys like Shift, Ctrl, and Windows.
The key codes for the Shift, Alt, Ctrl, and other shifting keys are determined the same way as for ordinary keys, using VA$KC (or VA$SC if the keyboard is in an unshifted state). Just bear in mind that the key code for shifting keys isn't returned until the key is *released*. You can see this by running U2 frame SCAN. When you press an ordinary key, the scan code is displayed right away (on the down press), but when you press a shifting key, the key has to be released before the code displays.
-- Martin J. Osborne http://www.economics.utoronto.ca/osborne Theoretical Economics http://econtheory.org PoET http://theory.economics.utoronto.ca/poet