Subject: bug#14794: 24.3.50; `w32-register-hot-key' does not work on Windows 7 64-bit

From: Eli Zaretskii <[email-masked]>
Date: Thu, 11 Jul 2013 19:36:35 +0300

> Date: Wed, 10 Jul 2013 15:28:37 -0700 (PDT)
> From: Drew Adams <[email-masked]>
> Cc: [email-masked]
> 
> > > emacs -Q    ; but same problem with older Emacs versions
> > >
> > > (w32-register-hot-key [M-tab])
> > > (w32-register-hot-key [M-S-tab])
> > >
> > > Try C-h k M-TAB.  Try M-TAB.  The key is immediately grabbed by Windows.
> > 
> > Because it is not bound to any command.  If you bind it, it will work
> > as expected.
> 
> Nope, not as far as I can see.  Add this to the recipe:
> 
> (global-set-key [M-tab] 'forward-char)
> 
> Makes no difference.  But perhaps you meant something different?
> 
> I'm using Windows 7 64-bit, if that makes a difference.
> (And the same code worked fine on Windows XP SP3.)

Turns out it does make a difference.  This documentation page:

  http://msdn.microsoft.com/en-us/library/windows/desktop/ms646309%28v=vs.85%29.aspx

explicitly says that the behavior of the underlying API has changed
since XP: if the hot key is already registered, the API now fails
instead of replacing the old registration with the new.  And Alt+TAB
is hooked by the Windows Explorer.  And indeed, on Windows 7 I see
that the call to RegisterHotKey API consistently fails with an error
code which says "Hot key is already registered".

Unless someone knows a way around this (I searched for it, but didn't
find any solutions, only complaints), I guess this will remain a
"known bug".

Does this work for you with other key combinations, btw?