What is the scancode of "Pause/Break" key?
Asked Answered
H

6

10

I download "SharpKeys.exe" from here. It works well. But I want to change "Pause/Break" to another, this app cannot recognize this key correctly. Does any one know the scancode? Thx

Hyperbaton answered 9/8, 2016 at 9:2 Comment(1)
I was able to remap it flawlessly using only SharpKeys (I posted an answer about how I did it). The accepted answer is wrong. It can be done, and you don't have to use any other tool. : )Takin
A
19

Pause is a very special non-typematic key with an unusual scan code (E1 1D 45 E1 9D C5). This is too long to be remapped using SharpKeys (or any program that uses the registry to do scan code remappings, since this feature is limited to 2-byte scancodes). If you try to remap it, you'll get only the first two bytes, and end up remapping the Num Lock key instead. This breaks in all sorts of hilarious ways.

You will need to use another program to do the remapping, perhaps something like AutoHotKey. But I'm not sure this will actually work, given how special this key is.

It is not clear why a programmer would ever want to remap Pause/Break. This is a very useful key, one that is often painfully missing from laptop keyboards where your only option is to remap another key to Ctrl+Break (scan code E0 46). This gives you back at least part of the function of a real Pause/Break key.

Adactylous answered 9/8, 2016 at 12:15 Comment(6)
Thank you. But I don't think this key is useful. So, I decide to remap Scroll-Lock key.Hyperbaton
I don't know what the OP's use case was, but I have a tablet keyboard that has pause right next to the spacebar, so I could see someone wanting to remap it to space in case they brushed against it. Especially since pause isn't useful for anything except poorly-designed games and breaking execution (which I have almost 100% been able to use Ctrl-C for).Escorial
@Escorial Sure, that makes sense, but I said "a programmer". Breaking execution is something that I do like 50 times a day. Ctrl+C doesn't work in most Windows debuggers that I'm aware of, but Ctrl+Break does. You could maybe get away with F12 in checked builds of Windows, but not nearly enough developers run those.Adactylous
Well, if you want to talk about debugging in Windows, I'm using .NET, so Visual Studio takes Shift-F5 to stop debugging. I don't think it is a good attitude to always assume everyone does things the way you do and "why would they ever want to do otherwise?". (btw I was thinking shell scripts in Linux as far as a good use of Ctrl-C)Escorial
how could you actually use the pause/break key nowadays? I would love to learn about thatCablet
@huangzonghao In almost every Windows debugger that I'm familiar with, Ctrl+Break will break the execution of the currently-executing program, dropping you into the debugger.Adactylous
T
8

I remapped Pause / Break key flawlessly using only SharpKeys! This is how I did it:

I also downloaded SharpKeys (which, by the way, is awesome), and at first was also unable to change the Pause/Break key to another key (my case wanna change to Media:Play/Pause).

After a little research, found this page blog: https://www.neox.net/w/2008/02/13/keyboard-remap-pause-break-key-as-del-key/
There, the guy was able to remap the key just using the first 2 bytes of the sequence. E1 and 1D. (he also messed around with Del key, which is unnecessary)

Since SharpKeys is already a great tool, I just download its code and added to the key map table this key code E1 1D and was able to remap using it without any further modifications.


Long story short:

I downloaded the source code of SharpKeys, and added to its code, file Dialog_Main.cs, method BuildParseTables(), the line m_hashKeys.Add("E1_1D", "-by Vitox: Pause/Break");

After that, I was able to remap the Pause/Break key flawlessly.


Resources:

Source code of SharpKeys, after changes
Source code of SharpKeys, after changes

Interface of SharpKeys, after mod
Interface of SharpKeys, after mod


SharpKeys: https://github.com/randyrants/sharpkeys
by the way, Randy Rants, this is a great tool. Thank You!


note: the keyboard where this mod worked was a Logitech G413, and OS was Windows 7

Takin answered 28/5, 2020 at 14:8 Comment(1)
This is great and all that, but how do I compile the edited code? And being one of the few ones who knows what compiling actually is, I count my self lucky, so.... ????Mostly
F
4

You must edit: E11D to Delete and E046 to Delete

There is file to download: https://www.neox.net/w/2008/02/13/keyboard-remap-pause-break-key-as-del-key/

I know this is a former topic, but maybe someone has MSI GL75 with a senseless keyboard like me :)

Fluoride answered 9/11, 2019 at 18:32 Comment(2)
this is the MSI model I recently bought, but if you think that this keyboard is ridiculous look up Asus TUF Gaming FX705 :DYorgos
ASUSeless keyboards have the on/off-button at the spot for the Del-key so they're like, always ridiculous...Mostly
L
4

Glad people are liking the tool but to be clear, Pause/Break is a special key that is not easily remapped. The Windows technology that remaps the keys only supports double-byte enabled scancodes. Some newer keys are triple-byte and those are dropped to the floor. Pause/Break is a hextuple-byte scancode.

By remapping the first part of that you may have successfully remapped Pause/Break but you are also remapping every other key that starts with E1 1D as well. On your keyboards this may not matter but I wouldn't recommend trying it without a backup plan.

I also highly recommend Microsoft's PowerToys for remapping modified keys (e.g. Ctrl+C) or weird keys that SharpKeys cannot map.

HTH!

Loganloganberry answered 6/11, 2020 at 21:22 Comment(0)
N
0

The insight from @Vitox is really helpful. Yet, the visual code community is quite a chunk and if you don't wanna bother to compile the modded version yourself, I have a simple solution here.

The scan code for Pause/break key is (E1 1D 45 E1 9D C5). The simple approach is to make the configuration via sharpkeys and remap Special: Hanja Key (E0 F1) to the desirable key, say F11 (00 57). Open registry, navigate to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout], and export all the stuff in the path of [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] to a .reg file. Open the .reg file, locate the f1,e0 segment (you can search ",f1,e0,"), change f1 to 1d and e0 to e1, save and import to registry. Then the trick will do after a restart.

You will also see the configuration in sharpkeys. See proof. However, it is not possible to export them from sharpkeys side. Sharpkeys will ignore that (E1_1D)-(00 57) pair that is not natively built-in.

PS: This is a simple configuration replacement and absolutely do in my environment on Windows 10. Nonetheless, it's just a sidestep saving you from installing 10+ gigabytes (or 20+? whatever) of MS visual studio community. I really hope someone could release a built version of sharpkeys to natively support the pause/break key remapping.

Nervine answered 9/12, 2022 at 2:17 Comment(1)
This doesn't actually work. Like, at all. ActuallyMostly
C
0

thank you, @Vitox for the correct "Pause" E1_1D code, i was not able to find it in the "unknown codes" in SharpKeys

I was able to remap my pause key to print screen in powershell (windows in bootcamp, long story short.. wanted Fn+ESC to take screenshots, and Fn+ESC registers as "pause"

here's the ps1:

$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout"

# Pause/Break = (E1_1D) to PrintScreen = (E0_37)
$scancodeMap = @(
    0x00, 0x00, 0x00, 0x00,   
    0x00, 0x00, 0x00, 0x00,   
    0x03, 0x00, 0x00, 0x00,   
    0x37, 0xE0, 0x1D, 0xE1,   # Pause/Break (E1_1D) to Print Screen (E0_37)
    0x00, 0x00, 0x00, 0x00    
)

   
$byteArray = [byte[]]$scancodeMap


Set-ItemProperty -Path $regPath -Name "Scancode Map" -Value $byteArray

# Dont forget to restart

after the script was run, sharpkeys says map this key (E1_1D) to "special: PrtSc (E0_37)

SharpKeys

Thanks for the help again!

Chancellery answered 22/8 at 21:16 Comment(1)
Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From ReviewCupbearer

© 2022 - 2024 — McMap. All rights reserved.