Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shift+Ctrl+0 key combination not seen by application on Windows Vista

I start with a new Delphi VCL application, add Menus to the uses clause, drop a label on the form, and assign the form's OnShortCut event:

procedure TForm1.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
begin
  Label1.Caption := ShortCutToText(ShortCut(Msg.CharCode, KeyDataToShiftState(Msg.KeyData)));
end;

On XP, this works correctly for all shortcut key combinations that I've tried, including Shift+Ctrl+0. On Vista and Windows 7, the test application displays Shift+Ctrl+1 through Shift+Ctrl+9, but not Shift+Ctrl+0. Other combinations like Shift+0, Ctrl+0, and even Shift+Ctrl+Alt+0 are displayed fine.

Running the application under the debugger, I find that the OnShortCut event is never fired with Msg.CharCode = Ord('0') if both the Shift and Ctrl keys are held down while the 0 key is pressed.

The Delphi IDE has the same problem under Vista. Ctrl+Shift+1 sets bookmark 1, but Ctrl+Shift+0 does not set bookmark 0, which it should.

I've tested this with Delphi 2007 and 2010 on virgin installs of Windows Vista and 7 in VMware, so there's no 3rd party software trapping the keys. I haven't tried any other development tools to determine if the problem is with Delphi or with Vista itself.

like image 452
Jan Goyvaerts Avatar asked Sep 23 '09 08:09

Jan Goyvaerts


People also ask

What does Ctrl Shift and 0 do?

If your WS Ctrl+Shift+0 (unhide selection columns) keyboard shortcut won't work, then follow these steps to fix the problem. See figure 1 for animated demonstration of hide/unhide selection rows, and hide/unhide selection columns.

How do I add a hotkey in Delphi?

In Delphi, associating a shortcut key with a menu item (pull-down menus cannot have a shortcut key) is very easy. You simply select a value for the ShortCut property, choosing one of the standard combinations: Ctrl or Shift plus almost any key. You might even add shortcut keys to a program without adding a real menu.

How do I enable Ctrl on Windows 10?

All you have to do to get copy and paste working in Windows 10 is to right-click on the command prompt's title bar, choose Properties… And then click “Enable new Ctrl key shortcuts”. You'll probably have to click the “Enable experimental console features” checkbox first though.


1 Answers

Shift+Ctrl+0 is preassigned in Vista to the input method editor (IME) :

http://support.microsoft.com/kb/967893

This will solve your problem but will impact users of IMEs (mostly asian versions), so you should consider not using this shortcut.

like image 80
fbonnet Avatar answered Nov 07 '22 19:11

fbonnet