Disable the activation of the menu bar when Alt is pressed in Windows 7
I've been using AutoHotkey already, so I added this line to my script and it fixed this annoying behavior in almost all applications:
~LAlt Up:: return
It doesn't work in IE but I don't use IE anyway. :)
BTW, I also killed the annoying start menu popup via:
~LWin Up:: return
~RWin Up:: return
I found this question because I have a new keyboard and sometimes accidentally hit the ALT key when typing emails in Gmail. The focus is lost and any following keystrokes are passed to my browser (which can have very annoying results sometimes).
The best solution I found, which is an improvement but not perfect, is with a keymapper program called KeyTweak, which as far as I understand, changes the registry.
In the program, you map Left Alt to Right Alt, and Right Alt to Left Alt. This allows the Alt functions to still work somewhat (Ctrl-Alt-Delete). However, Alt-Tab is partially broken (at least on my Windows-7). It allows you partially to move to the other applications, but when you release the Alt key, the "selection" of the next application isn't made (you can make it with a mouse-click, however).
It's too bad Windows doesn't have something to prevent loss of focus from errant Alt presses. The Shift and Ctrl keys don't have that effect, for example.
This autohotkey does work for me on Windows 10:
Alt::Return ;Disables the key alt when it's pressed alone
(Zengabor's answer did not work for me).
All the glory to Rohwedder