   [Win32 API] Application closes just after it's started
  Hi, I'm having an issue with my application.. I'm learning DirectX at the moment. The problem is, when I try to start debugging (F5) it compiles fine and tries to run the app.It does start, all the initialisations take place, when it gets to the loop where I use PeekMessage (to stop rendering if there is a message waiting/sent) it peeks a few messages with pretty high numbers (like 49311 or 49361). I googled it and found out that those high numbers are "custom messages" created with my application (?whatever).Ok, but what's the problem? The problem is that after these messages, message WM_QUIT (18) gets peeked and the application closes.It hasn't happened to me for the first time.. I can't remember how I fixed this issue in my previous apps.I thought there was something wrong with my D3D initialisation and I commented all the lines that use DirectX (even #define <d3d9.h>) but the issue does not lay on DX part.Here is the project: Project filesI asked my friend to compile and test it himself.. he says it happens to him too. So there must be something wrong with the code not my PC but what?Thanks in advance.   
  There's no break in WM_CREATE in your WndProc.. so it keeps going and executes the code under WM_CLOSE etc. =)You should also add a break to your WM_KEYDOWN, since the breaks inside the contained switch(wParam) only breaks out of that, and not the outer switch(msg). It doesn't matter here since there are no cases after WM_KEYDOWN, but you could add such later so make sure not to forget it.   ;  Make sure that all the cases in your switches has a break (unless you actually want the case to fall through), and it will work just fine.edit: Too late   ;  I knew it... I remember I had that issue before and I did fix it but as you don't use the language for long you forget lots of things. It was so ridiculously easy.Thanks :)   