I have a modeless dialog that I have changed the shape into a roundrect using SetWindowRgn(). I would like to draw a colored border around it using FrameRgn. Here is the code I am using:

BOOL CMyDlg::OnInitDialog()


CRect rcDialog;

// This Creates area assigned to Dialog: This goes directly below the above in OnInitDialog
m_rgnShape.CreateRoundRectRgn(rcDialog.TopLeft().x, rcDialog.TopLeft().y, rcDialog.BottomRight().x,
rcDialog.BottomRight().y, rcDialog.Width()/8, rcDialog.Height()/8);

::SetWindowRgn(GetSafeHwnd(), (HRGN)m_rgnShape, TRUE);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE

void CMyDlg::OnPaint()
CPaintDC dc(this); // device context for painting

CBrush brush;

dc.FrameRgn(&m_rgnShape, &brush, 2, 2);

Can anyone explain why the FrameRgn is not working, and maybe provide some sample code that will make it work.

Thanks in advance,