How can I detect whether the user’s keyboard has a Break key?

Raymond Chen

Some time ago, a customer wanted to know whether there was a way to detect whether or not the user’s keyboard has a Break key. “Our program has a hotkey that involves the Break key. Nowadays, the trend in laptop keyboards is to remove the Break key, which leaves users no way to invoke the hotkey. We want to offer an alternate hotkey, but only if the user’s keyboard doesn’t have a Break key.”

The device driver people explained that the driver has no idea what physical keys are present on the keyboard. So there’s no way to know whether a Break key exists, except by inferring the presence of such a key if you ever see a report that says “Hey, the user hit the Break key.”

That answers the technical problem: No, there is no way to know whether the keyboard has a physical Break key, or at least no way at the driver level to know.

But even if it were possible, from a user experience point of view, you don’t want to change the hotkey based on whether the keyboard has a Break key. For one thing, it forces the user to remember additional state: They have to use one hotkey when at their desktop PC, and another hotkey when using their laptop.

The user may have a Bluetooth keyboard paired to the laptop, even though they are actively using the integrated keyboard. If the Bluetooth keyboard has a Break key, the program would require the user to use the Break hotkey, even though the laptop keyboard doesn’t have a Break key.

If the user is on the edge of Bluetooth range, that Bluetooth keyboard may come and go randomly, at which point the application hotkey changes randomly.

And changing the hotkey based on the keyboard the user typed on most recently is even more crazy.

The customer accepted our explanation that there is no way at the driver level to detect what types of keys are available on the current keyboard, and that even if you knew, you probably shouldn’t act on it. Best would be to leave both sets of hotkeys active at all times.


Discussion are closed.


Feedback usabilla icon