Today I spent a lot of time on a seemingly simple task. I’m writing a tool I need for Jayden using the Win32 API. In general, I quite like the Win32 API, but I ran into an annoying quirk today. I finally found the solution and I’m documenting it here to help other people that might run into the same problem and to make sure I don’t have to go through all this trouble again if I run into this problem in the future.
What I want sounds quite simple: I want to make it impossible for the user to close my modal dialog box by pressing Escape. Normally, this would break expected behaviour, but if you’re using a dialog box as your main window, it actually makes sense. I’ll go over the procedure to do this step by step. Don’t leave before we get to multiline edit controls, though, because that’s where it really gets weird.
» Read the rest of this post.