News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Implementing MouseKeys

Started by xmetal, December 12, 2008, 11:00:27 AM

Previous topic - Next topic

xmetal

I'm having trouble rolling my own MouseKeys program - when a key on the numeric keypad is pressed, it does not generate the expected key code and flags, according to the low-level keyboard hook procedure.

For example, on pressing 0, a keycode of VK_INSERT and flags without the extended flag set, is generated, rather than VK_NUMPAD0 with the extended flag set (or at least that is what I think should be generated). On pressing 1, although the keycode is VK_NUMPAD1, the extended flag is not set. Numlock makes no difference whatsoever.

And I still haven't been able to figure out how to recognize the Period/Del key.

I'd like to keep the arrow keys for cursor movement, the insert and delete keys for left/right mouse buttons, and the plus key for the middle mouse button.

I've attached the result of my struggles.

[attachment deleted by admin]

Tedd

I think you'll have to check the actual status of num-lock and then act accordingly, rather than relying on the 'extended' flag.
No snowflake in an avalanche feels responsible.

xmetal

I've finally figured it out. The seeds of my confusion were:

1. Misleading MSDN documentation. Contrary to what is mentioned, the extended flag is not set when a key on the numeric keypad is pressed, irrespective of the status of num lock. Instead, the extended flag is set when the "stand-alone" insert, delete etc. keys are pressed.

2. My assumption/expectation that the virtual-key codes for the printable character keys are the same as their corresponding ASCII values. This is not always true for the "overloaded" keys. For instance, the >. key generates the keycode 0xBE, rather than 0x2E. Incidentally, 0x2E is the keycode for insert. I wonder why they had to do that.  ::)

Anyway, I'll fix my program now.

xmetal

Whee!  :dance:

Now all I have to add is speed control and pause/stop features, perhaps with a nice front-end.

Edit: Fixed a bug.

[attachment deleted by admin]

xmetal

Would have finished this sooner, but got caught up with other stuff.

Anyway, although I managed to put in all the features that I had originally planned for:


  • Speed control of cursor keys, and speed "blending" with Shift, Ctrl and Alt keys
  • Customizable "action" keys
  • Command line options and single instance operation

I could not implement (at the code level) the blending operation the way I wanted to, due to some peculiar Shift key behavior.

Annoyingly, I can't seem to get the visual styles to apply.

[attachment deleted by admin]