Hi All I am trying to call GetUpdateRgn() function in Onpaint() but iam getting error Code: error C2664: 'CWnd::GetUpdateRgn' : cannot convert parameter 1 from 'HRGN' to 'CRgn I tried to typecast HRGN to CRgn but it didnt work out ,below iam sending the code Code: HRGN m_hUpdateRgn; GetUpdateRgn(m_hUpdateRgn,0); CPaintDC dc(m_hWnd); dc.FrameRgn(m_hUpdateRgn,NULL,4,4);
CRgn is an MFC class wrapper for the HRGN handle as used by the API. You have to declare a CRgn object, then attach it to the HRGN handle: Code: HRGN m_hUpdateRgn; CRgn MyRgn; GetUpdateRgn(m_hUpdateRgn,0); MyRgn.FromHandle(m_hUpdateRgn); CPaintDC dc(m_hWnd); dc.FrameRgn(MyRgn,NULL,4,4);