How To Disable Globally Ctrl+Break Hotkey for stoping Code (1 Viewer)

taifoor

Registered User.
Local time
Today, 13:16
Joined
Jul 16, 2015
Messages
62
Dear All,

I need to disable functionality of Ctrl+Break or Break Only Or Fn+Break. I am using Autokeys Macro but Autokeys Macro do not supporting Disabling Break Key i.e. {Break}.

Please help.
 

isladogs

MVP / VIP
Local time
Today, 10:16
Joined
Jan 14, 2017
Messages
18,209
Go to File...Database Options and UNTICK Use Access Special Keys

NOTE
1. That will also disable some other keyboard shortcuts. See help file
2. Not sure if it will disable Fn +Break
 

taifoor

Registered User.
Local time
Today, 13:16
Joined
Jul 16, 2015
Messages
62
Go to File...Database Options and UNTICK Use Access Special Keys

NOTE
1. That will also disable some other keyboard shortcuts. See help file
2. Not sure if it will disable Fn +Break

Thanks for your help. I do go through that. But my keyboard have break key to be run with Fn+Break. So its not stopping this Fn+Break.
 

isladogs

MVP / VIP
Local time
Today, 10:16
Joined
Jan 14, 2017
Messages
18,209
It is possible to block any keyboard combination using a registry hack but it will then apply for all Windows applications on that computer.
It would also need to be added to each computer

The easiest way to do this is to download a utility called SharpKeys from: https://github.com/randyrants/sharpkeys

Or you can edit the registry yourself if you feel confident about that!
 

taifoor

Registered User.
Local time
Today, 13:16
Joined
Jul 16, 2015
Messages
62
It is possible to block any keyboard combination using a registry hack but it will then apply for all Windows applications on that computer.
It would also need to be added to each computer

The easiest way to do this is to download a utility called SharpKeys from: https://github.com/randyrants/sharpkeys

Or you can edit the registry yourself if you feel confident about that!

Thanks. But i need to do that only for My Database. So this solution seems not perfect fit.
For other keys, i used following code on KeyDown Event of relevant forms e.g.

-------------------------------------------------------
If KeyCode = vbKeyPageDown Then
KeyCode = 0 ' Kill the keypress
End If
If KeyCode = vbKeyPageUp Then
KeyCode = 0 ' Kill the keypress
End If

If Shift = acCtrlMask Or Shift = acCtrlMask + acShiftMask Then
If KeyCode = vbKeyAdd Or KeyCode = vbKeySubtract Or KeyCode = 187 Or KeyCode = 189 Then '187=+ and 189=-
KeyCode = 0 ' Kill the keypress
End If
End If
-------------------------------------------------------

But not able to stop Break key with this technique.
 

isladogs

MVP / VIP
Local time
Today, 10:16
Joined
Jan 14, 2017
Messages
18,209
Looks like you already know much of the code needed
Unfortunately, not all key combinations can be disabled using VBA
AFAIK all keys including Break can be disabled via the Registry
However my keyboard doesn't have a brak key or a Fn key so I can't test for you

You might be interested in the attached example which I posted here a few months back.
I intended to do more with it but forgot about it.

It allows you to disable almost all keys (except those I chose to allow) using built in code rather than SharpKeys
You can view the code using the shift key bypass

Two attached Word docs might be useful also

Any questions, get back to me
 

Attachments

  • LockDatabase.zip
    413.5 KB · Views: 136

taifoor

Registered User.
Local time
Today, 13:16
Joined
Jul 16, 2015
Messages
62
Great Work. Could you please guide me which code i have to copy in my DB and modify it accordingly to block Fn+Break Key for my DB only.

Please note that in my DB, i have to use shortcut keys for my button by Alt Combination.

Alos could you please check for DB Property AllowBreakIntoCode. Will changing this serves the purpose.
 

taifoor

Registered User.
Local time
Today, 13:16
Joined
Jul 16, 2015
Messages
62
Hi. I have seen your DB. Your DB also not stoping Fn+Break Key.
 

isladogs

MVP / VIP
Local time
Today, 10:16
Joined
Jan 14, 2017
Messages
18,209
If you play with my example database, you should get most of your answers.
I wasn't trying to stop that combination in my db

As I don't have either Fn or Break key I can't test it.
I suggest you read my 2 Word docs, use SharpKeys to edit the registry then transfer the code to your own database.

However, even if it can be done, it means you will not be able to use either key in any other application. Is this really a good idea?

Not heard of that DB property before. Suggest you google it and post back with your findings
 

Users who are viewing this thread

Top Bottom