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

Redick
  • 149
  • 1
  • 1
  • 8
  • 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. : ) – Vitox Jun 25 '20 at 15:12

5 Answers5

18

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.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 2
    Thank you. But I don't think this key is [useful](https://en.wikipedia.org/wiki/Break_key). So, I decide to remap Scroll-Lock key. – Redick Aug 09 '16 at 12:50
  • 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). – NH. Jul 26 '17 at 03:37
  • 1
    @NH. 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. – Cody Gray - on strike Jul 26 '17 at 07:02
  • 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) – NH. Jul 26 '17 at 15:05
  • how could you actually use the pause/break key nowadays? I would love to learn about that – hzh Oct 21 '20 at 21:15
  • @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. – Cody Gray - on strike Nov 14 '20 at 08:02
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

Vitox
  • 3,852
  • 29
  • 30
  • 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.... ???? – GwenKillerby May 23 '23 at 09:38
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 :)

  • this is the MSI model I recently bought, but if you think that this keyboard is ridiculous look up Asus TUF Gaming FX705 :D – Bart Az. Jun 25 '20 at 10:14
  • ASUS*eless* keyboards have the **on/off**-button at the spot for the **Del**-key so they're like, **always** ridiculous... – GwenKillerby May 23 '23 at 08:34
3

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!

Randy
  • 31
  • 2
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.

Backport
  • 1
  • 1