GetClipRgn

  • Thread starter Thread starter M Woolcott
  • Start date Start date
M

M Woolcott

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?
 
"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);
 
Back
Top