diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 7e0deb8b46..982714f7bc 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -437,13 +437,14 @@ private: wxDECLARE_NO_COPY_CLASS(ScreenHDC); }; -// the same as ScreenHDC but for window DCs +// the same as ScreenHDC but for window DCs (and if HWND is NULL, then exactly +// the same as it) class WindowHDC { public: WindowHDC() : m_hwnd(NULL), m_hdc(NULL) { } WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } - ~WindowHDC() { if ( m_hwnd && m_hdc ) { ::ReleaseDC(m_hwnd, m_hdc); } } + ~WindowHDC() { if ( m_hdc ) { ::ReleaseDC(m_hwnd, m_hdc); } } operator HDC() const { return m_hdc; }