// Created: 20.08.2003 (extracted from os2/utils.cpp)
// RCS-ID: $Id$
// Copyright: (c) David Webster
-// License: wxWidgets licence
+// License: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
)
{
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, wxStringBuffer(vStr, lLen));
+ }
return vStr;
}
)
{
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, wxStringBuffer(vStr, nLen));
+
+ if (nCount == nLen )
+ {
+ // the class name might have been truncated, retry with larger
+ // buffer
+ nLen *= 2;
+ }
+ else
+ {
+ break;
+ }
}
}
return vStr;