title: MessageBox does not work in a catch of an exception
body: <p>Well I have 2 issues but my main concern right now is my catch exception. Here is the code...</p>
  
  <pre><code>int GXRenderManager::Ignite(HINSTANCE * hinst, int * nCmd, GXDEVICE DeviceType, int width, int height)
  {
   try
   {
    GXRenderManager::hinstance = hinst;
    GXRenderManager::nCmdShow = nCmd;
  
    GXRenderManager::height = height;
    GXRenderManager::width = width;
  
    InitWindows();
  
    switch(DeviceType)
    {
    case DIRECTX:
     GXRenderManager::renderDevice = new GXDX;
     break;
    case OPENGL:
     GXRenderManager::renderDevice = new GXGL;
     break;
    default:
     throw GXException(L"Error Finding Video Device"); 
    }
  
    Device()-&gt;StartUp(GXRenderManager::mainWindow ,width, height); //Error happens here
   }
   catch(GXVideoException &amp;e)
   {
    MessageBox(0,e.pReason,L"GXVideoException",1);//Catch happens but no message box
    return 0;
   }
   catch(GXWindowsException &amp;e)
   {
    MessageBox(0,e.pReason,L"Windows Error",1);
    return 0;
   }
   catch(GXException &amp;e)
   {
    MessageBox(0,e.pReason,L"Error",1);
    return 0;
   }
  
   return 1;
  }
  </code></pre>
  
  <p>Here is where the error happens</p>
  
  <pre><code>void GXDX::StartUp(HWND* mainWindow,int w, int h)
  {
   width = w;
   height = h;
   this-&gt;mainWindow = mainWindow;
  
   ID3D10Texture2D *backBufferSurface;
  
   DXGI_SWAP_CHAIN_DESC swapChainDesc;
   swapChainDesc.BufferCount = 2;
   swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
   swapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
   swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
   swapChainDesc.BufferDesc.Width = width;
   swapChainDesc.BufferDesc.Height = height;
   swapChainDesc.SampleDesc.Count = 1;
   swapChainDesc.SampleDesc.Quality = 0;
   swapChainDesc.OutputWindow = *mainWindow;
   swapChainDesc.Windowed = TRUE;
  
   D3D10_DRIVER_TYPE driverType = D3D10_DRIVER_TYPE_HARDWARE;
  
   HRESULT hr = D3D10CreateDeviceAndSwapChain(NULL,driverType,NULL,0,
    D3D10_SDK_VERSION, &amp;swapChainDesc,&amp;swapChain,&amp;dxDevice);
  
   if(FAILED(hr))
    throw GXVideoException(L"Problems retrieving directX device");
  }
  </code></pre>
  
  <p>When I do a walk through. the D3D10CreateDeviceAndSwapChain returns a failure, therefore triggering the GXVideoException error.</p>
  
  <p>It then catches and returns back to GXRenderManager class as shown below. </p>
  
  <pre><code>catch(GXVideoException &amp;e)
   {
    MessageBox(0,e.pReason,L"GXVideoException",1);
    return 0;
   }
  </code></pre>
  
  <p>At this point in time, If I put my cursor over the &amp;e, I clearly see my message "Problems retrieving directX device". But the message box does not show</p>
  
  <pre><code>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
      LPSTR lpCmdLine, int nCmdShow)
  {
   if(GXRenderManager::Ignite(&amp;hInstance, &amp;nCmdShow,DIRECTX) != 1)
    return 0;
        //NEVER REACHES THE RUN METHOD BELOW YET THE MAIN WINDOW REMAINS OPEN
   GXRenderManager::Run();
  
   return 0;
  }
  </code></pre>
  
  <p>Another thing I find strange is that my created window remains showing but never reaches the main loop. It is like the application is idle due to the message box, but the message box is not showing...</p>
  
  <p>I also would like to add that the static member renderDevice is a interface datatype. GXDX is of course a implemented class of the interface.</p>
  
  <p>GXDX class includes the GXException Header so it is able to throw those exceptions so the main GXRenderManager can catch them.</p>
  
  <p>[EDIT]</p>
  
  <p>Another thing I would like to add is if I remove the Show window method</p>
  
  <pre><code>ShowWindow(*GXRenderManager::mainWindow, *GXRenderManager::nCmdShow);
  </code></pre>
  
  <p>It works. So as long as my main application window is not open. My message box appears like its suppose to.</p>
  
  <p>[EDIT]</p>
  
  <p>Prior to dauphic response which fixed part of the problem, I went on and edited my code. My catch now looks like this</p>
  
  <pre><code>catch(GXVideoException &amp;e)
      {
          MessageBox(*GXRenderManager::mainWindow,e.pReason,L"GXVideoException",1);
          return 0;
      }
  </code></pre>
  
  <p>But now my application opens and then immediately closes without displaying the box. mainWindow is a pointer to my base window. So I had to dereference the pointer. </p>
  
  <p>[EDIT]</p>
  
  <p>The windows pointer is bad</p>