MessageBox() --> closes hWndMain ???

Hello together...

I'm quite confused. I have an normal win32 App which barely dosen't do anything except opening a new Window. Just before closing the user is asked if he really wants to close the application:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   switch (message)
   {
      // ...
      case WM_DESTROY:
         if (userWantsQuit())
         {
            ExitInstance();
            PostQuitMessage(0);
         }
         break;   
      default:
         return DefWindowProc(hWnd, message, wParam, lParam);
         break;
   }
   return 0;
}
// --------------------------------------------
BOOL userWantsQuit()
{
   if (MessageBox(
      hWndMain,
      _T("Do you want to quit ?"),
      _T("Quit"),
      MB_YESNO | MB_ICONWARNING) == IDYES)
   {
      return TRUE;
   }
   return FALSE;
}

Every time the messagebox pops up the main window disappears :-( And the window won't come back with the help of showWindow() either.

Any suggestions?
Cheers
Nico
Ah, sorry... found out by myself -.-
It hast to be case WM_CLOSE: and not case WM_DESTROY: otherwise the window was already closed before showing the message box... so the problem wasn't related with the message box at all :D

Cheers
Topic archived. No new replies allowed.