Trying to use GetClipRgn from "OnDraw" (Visual C++ 2005), Windows XP. The
code is:
HRGN hRgnClip = CreateRectRgn(rcPaint.left, rcPaint.top, rcPaint.right,
rcPaint.bottom);
int nRet = GetClipRgn(pDC->m_hDC, hRgnClip);
bool bHasClipRgn = (nRet == 1);
.
.
"bHasClipRgn" is never True. Any ideas?
Michael Phillips, Jr. - 12 May 2008 18:14 GMT
> "bHasClipRgn" is never True. Any ideas?
You forgot to select the region into the device context.
HRGN hRgnClip = CreateRectRgn(rcPaint.left, rcPaint.top, rcPaint.right,
rcPaint.bottom);
HGDIOBJ hOldRgnClip = SelectObject(pDC->m_hDC, hRgnClip )// <------Add this
line
int nRet = GetClipRgn(pDC->m_hDC, hRgnClip);
bool bHasClipRgn = (nRet == 1);