Why does DestroyWindow close my application?

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-05-25T21:24:44Z Indexed on 2010/05/26 0:41 UTC
Read the original article Hit count: 240

Filed under:
|
|

I'v created a window after creating my main one but calling DestroyWindow on its handle closes the entire application, how can I simply get rid of it?

it looks like this:

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;
   HWND fakehandle;


   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW | WS_EX_LAYERED,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   fakehandle = CreateWindow(szWindowClass, "FAKE WINDOW", WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd || !fakehandle)
   {
      return FALSE;
   }
//some code
   DestroyWindow(fakehandle);


   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

how can I destroy this window without destroying my main one? I'm creating a dummy window to check for multisampling in OpenGL.

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about c