]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utils.cpp
Added wx/dirctrl.h to filelist.txt so it will get installed.
[wxWidgets.git] / src / msw / utils.cpp
index fcb1e515f697ae9e0db482278212403a82420844..590486daf8f55fc2438e227b38e203308f8745f4 100644 (file)
@@ -1381,59 +1381,47 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
 wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
 {
     wxString str;
-    int len = GetWindowTextLength((HWND)hWnd) + 1;
-    GetWindowText((HWND)hWnd, str.GetWriteBuf(len), len);
-    str.UngetWriteBuf();
+
+    if ( hWnd )
+    {
+        int len = GetWindowTextLength((HWND)hWnd) + 1;
+        ::GetWindowText((HWND)hWnd, str.GetWriteBuf(len), len);
+        str.UngetWriteBuf();
+    }
 
     return str;
 }
 
 wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
 {
-#ifdef __WXMICROWIN__
-    // MICROWIN_TODO
-    return wxEmptyString;
-#else
     wxString str;
 
-    int len = 256; // some starting value
-
-    for ( ;; )
+    // MICROWIN_TODO
+#ifndef __WXMICROWIN__
+    if ( hWnd )
     {
-        // as we've #undefined GetClassName we must now manually choose the
-        // right function to call
-        int count =
-
-        #ifndef __WIN32__
-            GetClassName
-        #else // Win32
-            #ifdef UNICODE
-                GetClassNameW
-            #else // !Unicode
-                #ifdef __TWIN32__
-                    GetClassName
-                #else // !Twin32
-                    GetClassNameA
-                #endif // Twin32/!Twin32
-            #endif // Unicode/ANSI
-        #endif // Win16/32
-                                    ((HWND)hWnd, str.GetWriteBuf(len), len);
+        int len = 256; // some starting value
 
-        str.UngetWriteBuf();
-        if ( count == len )
+        for ( ;; )
         {
-            // the class name might have been truncated, retry with larger
-            // buffer
-            len *= 2;
-        }
-        else
-        {
-            break;
+            int count = ::GetClassName((HWND)hWnd, str.GetWriteBuf(len), len);
+
+            str.UngetWriteBuf();
+            if ( count == len )
+            {
+                // the class name might have been truncated, retry with larger
+                // buffer
+                len *= 2;
+            }
+            else
+            {
+                break;
+            }
         }
     }
+#endif // !__WXMICROWIN__
 
     return str;
-#endif
 }
 
 WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)