CWindowDC dc(this); 
  
CRgn rgn; 
CRect rcWindow, rcClient; 
GetWindowRect(rcWindow); 
GetClientRect(rcClient); 
ClientToScreen(rcClient); 
rcClient.OffsetRect(-rcWindow.TopLeft());

rgn.CreateRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); 
dc.SelectClipRgn(&rgn, RGN_DIFF);