]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
compilation fix after wxScrollHelper changes (ctor argument is now not optional and...
[wxWidgets.git] / src / msw / window.cpp
index 0874381013c364b7b9d0335bad8af1ec2f16c4ba..66fcdf4355af805c49fe4b9273ff4239e9528caa 100644 (file)
@@ -151,7 +151,7 @@ static bool gs_hasStdCmap = false;
 
 // last mouse event information we need to filter out the duplicates
 #if wxUSE_MOUSEEVENT_HACK
-static struct
+static struct MouseEventInfoDummy
 {
     // mouse position (in screen coordinates)
     wxPoint pos;
@@ -704,12 +704,23 @@ bool wxWindowMSW::Show(bool show)
         return false;
 
     HWND hWnd = GetHwnd();
-    int cshow = show ? SW_SHOW : SW_HIDE;
-    ::ShowWindow(hWnd, cshow);
 
-    if ( show && IsTopLevel() )
+    // we could be called before the underlying window is created (this is
+    // actually useful to prevent it from being initially shown), e.g.
+    //
+    //      wxFoo *foo = new wxFoo;
+    //      foo->Hide();
+    //      foo->Create(parent, ...);
+    //
+    // should work without errors
+    if ( hWnd )
     {
-        wxBringWindowToTop(hWnd);
+        ::ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE);
+
+        if ( show && IsTopLevel() )
+        {
+            wxBringWindowToTop(hWnd);
+        }
     }
 
     return true;