If the alt key is pressed before your application begins, or held down when your application cannot hook it (e.g., sent to a window of a process run as an administrator), your hook will eat the keyup for it and the rest of the system will still think it's being pressed down when the user stops pressing it.
You could use SendInput
to send a keyup for it after your hook is done (or during with a filter for it built into your hook), but that won't ensure the window that got the keydown knows it's up. I'm not sure there is a particularly easy solution to that part.