X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..f3e156efb09c5c3ab4c4490abf58f2348edb1150:/src/os2/utilsgui.cpp?ds=sidebyside

diff --git a/src/os2/utilsgui.cpp b/src/os2/utilsgui.cpp
index 74a925615d..5b7e06cf34 100644
--- a/src/os2/utilsgui.cpp
+++ b/src/os2/utilsgui.cpp
@@ -6,7 +6,7 @@
 // Created:     20.08.2003 (extracted from os2/utils.cpp)
 // RCS-ID:      $Id$
 // Copyright:   (c) David Webster
-// License:     wxWidgets licence
+// License:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -428,8 +428,10 @@ void wxDisplaySize(
         ::DevCloseDC(hdcScreen);
         ::WinReleasePS(hpsScreen);
     }
-    *pWidth = (int)lWidth;
-    *pHeight = (int)lHeight;
+    if (pWidth)
+        *pWidth = (int)lWidth;
+    if (pHeight)
+        *pHeight = (int)lHeight;
 }
 
 void wxDisplaySizeMM(
@@ -515,10 +517,12 @@ wxString WXDLLEXPORT wxGetWindowText(
 )
 {
     wxString                        vStr;
-    long                            lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
 
-    ::WinQueryWindowText((HWND)hWnd, lLen, vStr.GetWriteBuf((int)lLen));
-    vStr.UngetWriteBuf();
+    if ( hWnd )
+    {
+	long                lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
+	::WinQueryWindowText((HWND)hWnd, lLen, (PSZ)(wxChar*)wxStringBuffer(vStr, lLen));
+    }
 
     return vStr;
 }
@@ -528,22 +532,24 @@ wxString WXDLLEXPORT wxGetWindowClass(
 )
 {
     wxString                        vStr;
-    int                             nLen = 256; // some starting value
-
-    for ( ;; )
+    if ( hWnd )
     {
-        int                         nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen));
-
-        vStr.UngetWriteBuf();
-        if (nCount == nLen )
-        {
-            // the class name might have been truncated, retry with larger
-            // buffer
-            nLen *= 2;
-        }
-        else
-        {
-            break;
+        int                         nLen = 256; // some starting value
+
+	for ( ;; )
+	{
+	    int                     nCount = ::WinQueryClassName((HWND)hWnd, nLen, (PSZ)(wxChar*)wxStringBuffer(vStr, nLen));
+
+	    if (nCount == nLen )
+	    {
+		// the class name might have been truncated, retry with larger
+		// buffer
+		nLen *= 2;
+	    }
+	    else
+	    {
+		break;
+	    }
         }
     }
     return vStr;
@@ -935,7 +941,7 @@ wxBitmap wxDisableBitmap(
     int                             j;
 
     //
-    // Bitmap must be ina double-word alligned address so we may
+    // Bitmap must be in a double-word aligned address so we may
     // have some padding to worry about
     //
     if (nLineBoundary > 0)