1
votes

I am using an implementation that reacts on simultaneously pressing the keys Ctrl + Alt + Shift + D meanwhile for over 2 months never having any issue. Two days ago I experienced that this short cut didn't work anymore (neither did it work on the released version, which for sure is a problem!). => Rebooting the PC eventually did its job and it worked again... ok... maybe (and hopefully) a spontaneous windows issue.

Dream on, today the same issue again and this time rebooting didn't solve it. So let's deal with it.

Here's my implementation:

private void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.D
        && e.Control == true
        && e.Alt == true
        && e.Shift == true)
    {
        // do things
    }
}

As I mentioned above, it worked reliably before being used quite often.

What I discovered so far is, that pressing down the keys Ctrl + Alt + Shift one by one the "MainWindow_KeyDown" function is called each time, as expected. Pressing down the D as well this function isn't triggered anymore, which is unexpected (when only pressing D this function is called).

Removing one of the "option" keys seems to work(e.g. Ctrl + Alt + D). But as soon I have all three option keys pressed (i.e. Ctrl + Alt + Shift) it doesn't react on further keys being pressed.

Why doesn't the function "MainWindow_KeyDown" react ("anymore") on D (or any other) when Ctrl + Alt + Shift are pressed already?

A q&d workaround was to replace

e.KeyCode == Key.D

by

Keyboard.IsKeyDown(Key.D) == true

This works as long as D isn't the last key pressed (because, as described above, it won't enter this function when having pressed the keys Ctrl + Alt + Shift already).

I tried the following implementation as well with the same (negative) result:

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    if (keyData == (Keys.Control | Keys.Alt | Keys.Shift | Keys.D))
    {
        MessageBox.Show("Short cut found");
        return true;
}
    return base.ProcessCmdKey(ref msg, keyData);
}

Any one that has experienced something similar? Thanks a lot for any input.

1
The first snippet can work if the Form.KeyPreview is set to true, ProcessCmdKey works in any case (if (keyData.HasFlag(Keys.Control | Keys.Alt | Keys.Shift | Keys.D)) { ... }), even when a Control uses an accelerator with similar keys.Jimi
As said, it worked as it's stated above (it still works on my companions pc. This makes me again believing that it's a LenovoX1 keyboard driver issue or something similar). The "Form.KeyPreview" didn't change its behaviour. Thx for your input!RadioMan85
I have a client with an MS Word macro assigned to Alt+Ctrl+Shift+D. This shortcut has run for years without trouble. All of the sudden, the client tells me this shortcut doesn't work on one of their PCs. I looked at the PC and the shortcut assignment is still there but pressing the key combination does nothing. Trying Alt+Ctrl+Shift with various random letters all register - except for F. Perhaps some recent windows update somehow clobbered those two key combinations from working? PC is a Dell Optiplex 3050 micro.voon
Update : I've tested a few other PCs, using the MS Word Customize Keyboard screen to see if it recognize an Alt+Ctrl+Shift+D shortcut key combination. All of the Win10 PCs I tried didn't work. I had a Win7 dev PC which did work however. (Here's some funky behaviour: I was RDP'ing into the Win7 PC from a Win10 PC. With the RDP running full screen it worked. With RDP in windowed mode, it didn't work.) So my theory is that this change is due to a recent update.voon

1 Answers

2
votes

I had the same issue, and the following 2 steps worked for me:

  1. Go to Device Manager -> Keyboards -> Right Click the keyboard(s) -> Uninstall device -> Restart the computer.
  2. Some programs are ruining this specific shortcut, in my research, i have seen people were it worked simply by closing Microsoft Teams, Cortana or Skype. For me it worked quitting Skype.