When you don't receive any message in Window procedure, you should call DefWindowProc()
function to handle any unprocesses message. So, you used break
statement under default
case in window procedure, which is wrong.
More on DefWindowProc()
function here: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-defwindowproca. Also, as others have stated, you did not use break
statements in case
blocks in window procedure. This is obivously wrong, because everything will execute, including handling from unreceived messages. And, lastly, my suggestion, you don't need to put curly brackets at the beggining of every case
block. You should do that only if you declare new variables in that scope, otherwise it isn't necessary, and it worsens code readability, as too much curly brackets can only cause confusion.