Issue was caused by VK_F4 having the same exact code as a lowercase 's'.Please resubmit without cpp style comments.
So the code, which treated WM_CHAR and WM_KEYDOWN as the same, executed
the wrong piece of code which was meant to be ONLY for WM_KEYDOWN.
Patch is attached.