Address a special key on my keyboard

Hi there,

I am using a cherry keyboard, which has 5 special keys.

These keys can be configured to to what ever you want, provided you have installed the Cherry Keymap programm. This has to run in the background. Unfortunatelly I can not install this tool here at work.

If the Keymap program is not installed, the keys trigger some standard windows function (mute, volum +/- etc.) There is a key, which runs the Standard Media player. However if I cusomize shortcuts in a screenshot tool, I can assign this Mediaplayer key to e.g. screenshot of the current window.

The Key shows up as “SelectMedia” in the Shortcut configuration.

Once assigned, the key triggers taking a screenshot instead of starting the mediaplayer.

I wonder, if I can use that key to trigger some function in a Xojo Program

Currently I am using
keyboard.AsyncControlKey and Keyboard.asyncKeyDown(&h10)
to check for ctrl + Y pressed. I wonder if I can use
Keyboard.asyncKeyDown(<whatever comes here for “SelectMedia” key>) instead??

try to avoid using aSyncKeydown and use the KeyDown Event of the window or specific control

In which case you would detect Ctrl-Y as Chrb(25). This value will be consistent across ANY keyboard, where the Keycodes may change from keyboard type to keyboard type

to see what “extra” keys might return, put this in the KeyDown Event for testing

msgbox str(ascb(key))

if nothing happens, then that key cannot be captured (period)… otherwise it will give you the value of the ASCII value of the character

Thanks will try that. But I can not use keydown event as I need to capture the shortcut globally even if my app is not the active one.

I capture the keys pressed in an timer event, that fires every 10ms. I need to use asynckeydown…

You should be able to get the value of the key by inspection. In the action event of a timer, loop through 0-255 and call AsyncKeyDown for each value. Hold down the key and report the one that returns true.