]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utils.cpp
fix for wxSYS_COLOUR_LISTBOX representation
[wxWidgets.git] / src / msw / utils.cpp
index d34d0ede3e952404493523bd24f5a35fcef40995..4c8e813969302ff7ce95f7515b9197a2d1fbdc87 100644 (file)
@@ -105,8 +105,6 @@ extern "C" {
 
 #include "wx/ioswrap.h"
 
-#include "wx/ioswrap.h"
-
 /* Need to undef new if including crtdbg.h */
 #  ifdef new
 #  undef new
@@ -456,13 +454,15 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
     if ( path.empty() )
         return FALSE;
 
-#ifdef __WIN32__
+// old w32api don't have ULARGE_INTEGER
+#if defined(__WIN32__) && \
+    (!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION( 0, 3 ))
     // GetDiskFreeSpaceEx() is not available under original Win95, check for
     // it
-    typedef BOOL (*GetDiskFreeSpaceEx_t)(LPCTSTR,
-                                         PULARGE_INTEGER,
-                                         PULARGE_INTEGER,
-                                         PULARGE_INTEGER);
+    typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
+                                                PULARGE_INTEGER,
+                                                PULARGE_INTEGER,
+                                                PULARGE_INTEGER);
 
     GetDiskFreeSpaceEx_t
         pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
@@ -492,12 +492,12 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
 
         if ( pTotal )
         {
-            *pTotal = wxLongLong(bytesTotal.HighPart, bytesTotal.LowPart);
+            *pTotal = wxLongLong(bytesTotal.u.HighPart, bytesTotal.u.LowPart);
         }
 
         if ( pFree )
         {
-            *pFree = wxLongLong(bytesFree.HighPart, bytesFree.LowPart);
+            *pFree = wxLongLong(bytesFree.u.HighPart, bytesFree.u.LowPart);
         }
     }
     else
@@ -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 )
-        {
-            // the class name might have been truncated, retry with larger
-            // buffer
-            len *= 2;
-        }
-        else
+        for ( ;; )
         {
-            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)