Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a program with various VB.Net menustrip items set to certain keyboard shortcuts. However, if Windows ease of access has the keyboard shortcuts turned off, I am looking for a way to turn them on with VB.net code.

What I have tried:

I have search high and low and all I have been able to find is how to turn them off / on manually. Any help will be appreciated.
Specifically I would like to first determine if the shortcuts are turned off. If the are, I want to turn them on and then when the application closes turn them off again. If they were on initially, the application would leave them on
Thanks in advance for any help/advice.
Posted
Updated 28-Sep-22 18:06pm
Comments
Dave Kreskowiak 28-Sep-22 21:34pm    
You should not be messing with this at all. That is a setting that is system-wide, so if you turn it on, it's not just for your app. It's for all apps on the machine, thereby changing how they function.

You should be respecting system-wide setting, not changing them.
Gary Corbell 2021 28-Sep-22 22:02pm    
Well, I did not ask for your 'opinion' about the etiquette I should be adhering too. Rather I ask a question of how to do some particular coding. And if you will read the question fully you will see my intentions are to turn it off after turning it on if the user's was turned off in the first place. And that includes if the app loses focus. Downgrade me all you want, I don't really care because I will be going somewhere else for my questions from now on.

1 solution

Quote:
Well, I did not ask for your 'opinion' about the etiquette I should be adhering too. Rather I ask a question of how to do some particular coding. And if you will read the question fully you will see my intentions are to turn it off after turning it on if the user's was turned off in the first place. And that includes if the app loses focus.
Dave is right: it's not a matter of "etiquette I should be adhering too", it's not even just a common courtesy - it's a deliberate attempt to undermine how the user (or the group policy administrator) has specifically told Windows to behave - and neither you nor I know why they have been disabled, or who by.

It may be that the device is running as a Kiosk and shortcut keys may pose a security risk, it maybe that the user is too dumb to remember how to use them! Nobody knows...

Changing system wide settings is always a bad idea, even if you intend to restore the original setti8ng when you are finished: it's like using TAB and ENTER to change the colours in your app: it makes it harder for the user to use your application in the context of the whole machine - similar to the way Refresh is F5 in 90% of apps, but F9 in Outlook; you have to specifically remember the exception which makes the app harder to use.

Instead if you really must have shortcuts, override Form.ProcessCmdKey[^] and handle them yourself. No guarantees the user will go along with that though!
Quote:
Downgrade me all you want, I don't really care because I will be going somewhere else for my questions from now on.
Sorry to hear that. Do you need assistance in closing your account?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900