X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d2b68baa3414a496bae9be99095e02f3b82a2df..7cec3a32a41a914e4bed8b731cabf3868d25c45e:/include/wx/msw/private.h diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 892d81c606..4bed1f04b8 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -597,7 +597,7 @@ private: HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) #endif // __WXWINCE__/!__WXWINCE__ -// smart buffeer using GlobalAlloc/GlobalFree() +// smart pointer using GlobalAlloc/GlobalFree() class GlobalPtr { public: @@ -643,7 +643,10 @@ public: void Init(HGLOBAL hGlobal) { m_hGlobal = hGlobal; - m_ptr = ::GlobalLock(hGlobal); + + // NB: GlobalLock() is a macro, not a function, hence don't use the + // global scope operator with it (and neither with GlobalUnlock()) + m_ptr = GlobalLock(hGlobal); if ( !m_ptr ) wxLogLastError(_T("GlobalLock")); } @@ -656,7 +659,7 @@ public: ~GlobalPtrLock() { - if ( m_hGlobal && !::GlobalUnlock(m_hGlobal) ) + if ( m_hGlobal && !GlobalUnlock(m_hGlobal) ) { #ifdef __WXDEBUG__ // this might happen simply because the block became unlocked @@ -901,9 +904,15 @@ inline bool wxStyleHasBorder(long style) // functions mapping HWND to wxWindow // ---------------------------------------------------------------------------- -// this function simply checks whether the given hWnd corresponds to a wxWindow +// this function simply checks whether the given hwnd corresponds to a wxWindow // and returns either that window if it does or NULL otherwise -extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd); +extern WXDLLEXPORT wxWindow* wxFindWinFromHandle(HWND hwnd); + +// without STRICT WXHWND is the same as HWND anyhow +inline wxWindow* wxFindWinFromHandle(WXHWND hWnd) +{ + return wxFindWinFromHandle(wx_static_cast(HWND, hWnd)); +} // find the window for HWND which is part of some wxWindow, i.e. unlike // wxFindWinFromHandle() above it will also work for "sub controls" of a