   Game won't fully exit
  In my blackjack game, I am instanciating a textbox using CreateWindowEx(). The player enters their bet and when they hit enter, I use PostMessage( hEditOne, WM_CLOSE , 0 , 0 ) and DestroyWindow(hEditOne) to remove the textbox. If the player closes the game at this point, everything is fine. However if the user closes the game while the textbox is still visible, the game never really exits. I have tried putting DestroyWindow() and PostMessge() in the WM_DESTROY case of WindowProc, but that still doesn't work. Is there something that I've left out?   
  You should probably use a modal dialog box for that. Then the user won't be able to close the main window while the textbox is displayed.;  It shouldn't, all child windows created by the parent window will automatically be destroyed when the parent window is destroyed. You may try the following code:HWND const hTemp = CreateWindow ("Edit", "AABB", WS_VISIBLE, 0, 0, 100, 100, hWnd, 0, g_hInstance, NULL) ;I guess the HWND and/or g_hInstance fields might go incorrect, as a bonus note: g_hInstance can be retrieved through lParam in WM_CREATE:reinterpret_cast<CREATESTRUCT *> lParam -> hInstanceGood luck.   