X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..c56ae04274fda26269c6d06be34cf59a45eb70ce:/src/os2/utilsgui.cpp diff --git a/src/os2/utilsgui.cpp b/src/os2/utilsgui.cpp index 74a925615d..66647fcd2e 100644 --- a/src/os2/utilsgui.cpp +++ b/src/os2/utilsgui.cpp @@ -1,12 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: os2/utilsgui.cpp +// Name: src/os2/utilsgui.cpp // Purpose: Various utility functions only available in GUI // Author: David Webster // Modified by: // Created: 20.08.2003 (extracted from os2/utils.cpp) // RCS-ID: $Id$ // Copyright: (c) David Webster -// License: wxWidgets licence +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -25,7 +25,6 @@ #endif #ifndef WX_PRECOMP - #include "wx/setup.h" #include "wx/utils.h" #include "wx/app.h" #include "wx/cursor.h" @@ -69,7 +68,7 @@ bool wxWriteResource( HAB hab = 0; HINI hIni = 0; - if (rFile != "") + if (!rFile.empty()) { hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile); if (hIni != 0L) @@ -153,7 +152,7 @@ bool wxGetResource( wxChar zDefunkt[] = _T("$$default"); char zBuf[1000]; - if (rFile != "") + if (!rFile.empty()) { hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile); if (hIni != 0L) @@ -428,8 +427,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( @@ -482,7 +483,7 @@ void wxGUIAppTraits::TerminateGui(unsigned long ulHab) wxToolkitInfo & wxGUIAppTraits::GetToolkitInfo() { - static wxToolkitInfo vInfo; + static wxToolkitInfo vInfo; ULONG ulSysInfo[QSV_MAX] = {0}; APIRET ulrc; @@ -510,31 +511,30 @@ wxToolkitInfo & wxGUIAppTraits::GetToolkitInfo() // window information functions // --------------------------------------------------------------------------- -wxString WXDLLEXPORT wxGetWindowText( - WXHWND hWnd -) +wxString WXDLLEXPORT wxGetWindowText( WXHWND hWnd ) { - wxString vStr; - long lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1; + wxString vStr; - ::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; } -wxString WXDLLEXPORT wxGetWindowClass( - WXHWND hWnd -) +wxString WXDLLEXPORT wxGetWindowClass( WXHWND hWnd ) { - wxString vStr; - int nLen = 256; // some starting value + wxString vStr; + if ( hWnd ) + { + int nLen = 256; // some starting value for ( ;; ) { - int nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen)); + int nCount = ::WinQueryClassName((HWND)hWnd, nLen, (PSZ)(wxChar*)wxStringBuffer(vStr, nLen)); - vStr.UngetWriteBuf(); if (nCount == nLen ) { // the class name might have been truncated, retry with larger @@ -545,6 +545,7 @@ wxString WXDLLEXPORT wxGetWindowClass( { break; } + } } return vStr; } @@ -935,7 +936,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)