Cannot catch Ctrl+Alt+F1 in WinForms MDI. Is it special?
Asked Answered
L

1

3

My WinForms MDI application has several keyboard shortcuts set at ToolStripMeniItem items.

Among the following ones:

  • Ctrl+Alt+F1
  • Ctrl+Alt+F2
  • Ctrl+Alt+F3

the first one is never triggering its menu item. Others work as expected.

  • Is it somewhere blocked/used? Is there some list of such blocked keyboard shortcuts?

  • Is there a way how to use it? (Preferably just via designer without adding special code?)

Liselisetta answered 21/2, 2015 at 18:39 Comment(0)
C
7

If I press Ctrl+Alt+F1 on my machine then it activates the "Intel HD Graphics Control Panel". A pretty well spread piece of useless malware that many machines have pre-installed, Intel is very irresponsible with their software. When I kill the igfxHK.exe process with Task Manager (HK = Hot Key) then this code in a MDI app works fine:

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
        Console.WriteLine((int)keyData);
        if (keyData == (Keys.F1 | Keys.Control | Keys.Alt)) {
            MessageBox.Show("Yada");
            return true;
        }
        return base.ProcessCmdKey(ref msg, keyData);
    }

I'll spare you the "Yada" screenshot. Otherwise a pretty typical hazard, programs that call RegisterHotKey() always get ahead of your shortcut keystroke and do whatever they are supposed to do. The Language Bar jumps to mind as another one. There are many others. Kill processes with Task Manager to find the evil-doer.

Not much you can do about it of course. You can run msconfig.exe to disable it but that doesn't do anything useful for your user's machine. These programs invariably pick the obvious keys, you could counteract by picking your shortcut keys from right to left. Best thing is to avoid keys that require more than one modifier, a user doesn't like them either.

Creatural answered 21/2, 2015 at 19:4 Comment(2)
Great answer. I fully agree with that about Intel software. After killing the Intel process I can create Ctrl+Alt+F1 even in designer, no need of coding in this case. But I won't fight it and I'll adjust key mappings accordingly...Liselisetta
Next day finding: Ctrl+Alt+F1, Ctrl+Alt+F5, Ctrl+Alt+F6, ... are consumed by IgfxHK.exe even if shortcut keys are disabled in its options! Unbelievable. What a coding mastery!Liselisetta

© 2022 - 2024 — McMap. All rights reserved.