What Key Combinations do by default on Windows, esp. Alt and Ctrl

Is there a reference for what these keys and key combinations do by default on Windows?
Is there a way to override their behaviors so I can use them in my app?
I want to catch these key events:

  • Spacebar (this opens a menu, I really don’t want it to do that)
  • shift + mousewheel (seems to work okay)
  • shift + control + mousewheel (crashes the app)
  • shift + alt + mousewheel (opens up the windows start menu, interferes with my app)

Thanks.

What are you doing in your app to catch these combinations ? None seem to do anything in a basic app.

I’m using Keyboard.Async… in the KeyDown and MouseWheel events of a Listbox

A problem seems to be what object is catching the keys. On Mac, the keys automatically get caught in the listbox, but it seems on Windows, the keys are caught somewhere else, I don’t know where. I have no other key catching code in the app, just in the listbox.

The crash you mention with Ctrl-Shift-Mousewheel seem to indicate a bug in your code.

If you use Keyboard.AsyncKeyDown, the whole app is getting the keys.

One would think so, yes, but there isn’t any. It works fine on Mac. For some reason Ctrl-Shift-MouseWheel on WIndows calls the EnableMenuItems event, which results in the inexplicable (Windows-only) crash I posted about here: https://forum.xojo.com/27691-bizarre-outofboundsexception-on-menuitem-remove-only-on-windows

I just created a small test app with no code. None of the manipulations you list does anything. Because none of them is a standard Windows system shortcut.

In Windows, the only modifier that triggers menus without app code is Alt.

You keep saying it works in Mac. If you posted some code, it would certainly help.

The code looks like any code you would expect to catch keys; there’s nothing special about it (and nothing wrong with it).

Knowing that these key combinations should do nothing by default is all I need to know; thank you.

You may not want to use AsyncXXXX as that means “is that key down right this instant” rather than “was this key down when this code path got started”

Good point; thank you.

Then there nothing else to say either but good luck.

Well, here is something I found on Windows that may be causing this:

“Sticky Keys” Control Panel. in Windows 7

Boy, this looks like a total nightmare…

There is a checkbox to “Lock modifier keys when pressed twice in a row”

That is checked on this machine. Ugh. Turning it OFF now.

I think this is not entirely accurate, because I find that pressing the Alt key sets the focus on the File menu.

I told you that in the very same post you apparently did not completely read :

Alt is the Windows shortcut for menus. Pressed by itself it selects the first menu. Pressed in combination with the title of a menu (for instance E for Edit), it drops it down.

See https://support.microsoft.com/en-us/kb/126449

Well, okay, you told me that. You also told me something contradictory.

The link is very helpful; thanks.

So all this leads to a related question, maybe a more useful question:

On Mac, we have 3 keys we can use in almost any combination with any other keys in our apps:

  1. Command
  2. Option
  3. Control

This give a wide variety of possible key commands.

A problem is, not all of those command can transfer to Windows. In fact, it appears the majority of them can’t be duplicated in Windows. We get a behavior with Alt that makes it virtually unusable as far as I can see. There is no way to just “replace” the Command or Option or Control key to get a parallel set of key combinations on Windows.

This seems pretty a basic issue for x-plat development but I have not relied much on keyboard shortcuts before, so it’s a bit new to me.

Is there some standard approach for dealing with this problem?

On the Mac you can use keys with NO modifier (thats joy)
Not so Windows
So you do end up with a set of Mac key mappings and one that mat be similar but not identical on Windows

So on OS X youmight use Cmd+Option
On Windows you might use Alt+Shift or Alt+Ctrl

We basically have a giant spreadsheet for the IDE of the ones we’ve assigned, ones the OS reserves etc

On Mac, we can use key combinations for things other than menu shortcuts, but on Windows this seems problematic, especially with Alt, it seems that should only be used for Menu shortcuts. Is that correct?

Nor should you. You should try to use the keys that make sense, and your users will expect, on each platform. Windows OS pretty much reserves the Alt key.

Alt can be used to trigger accelerators as well (like when you put &Foo in a label)
On the Mac that does nothing but it has meaning on Windows

http://windows.microsoft.com/en-ca/windows/keyboard-shortcuts#keyboard-shortcuts=windows-8