简体   繁体   中英

C# console shortcuts - how to disable?

I'm experimenting with the console's ConsoleKeyInfo.Modifers attribute. While pressing different combinations of alt, ctrl, shift and normal keys I found this (ctrl+f): 在此处输入图片说明 I run other console applications and even cmd.exe. The result: There are some shortcuts in all this console programms like ctrl+a, ctrl+f... Is there any way to disable these shortcuts?

Thank you!

You can change some of the properties of a console window programmatically, but not those specific features you mention in your question. You'd have to disable the option in the command prompt of the operating system, as @obizues has pointed out.

For what it's worth, you can modify the behaviour of CTRL+C programmatically, using Console.TreatControlCAsInput = true; , which would then allow you to handle any user key sequences of CTRL+C, rather than it being interpreted as an interrupt key.

They tend to all be different. In Windows 10 CMD you can go to properties and unselect "enable ctrl key shortcuts."

You can't, however, disable all Windows ctrl key shortcuts. At least that I'm aware of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM