bool bBlur = false;
void CTestGlassWindowDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
//OnOK();
bBlur = true;
// Negative margins have special meaning to DwmExtendFrameIntoClientArea.
// Negative margins create the "sheet of glass" effect, where the client area
// is rendered as a solid surface with no window border.
MARGINS margins = {-1};
HRESULT hr = S_OK;
// Extend frame across entire window.
hr = DwmExtendFrameIntoClientArea(this->m_hWnd,&margins);
if (SUCCEEDED(hr))
{
//do more things
}
}
BOOL CTestGlassWindowDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
if (bBlur)
{
CDC* dc = this->GetDC();
CRect rect;
VERIFY(::GetClientRect(this->m_hWnd,&rect));
dc->FillSolidRect(&rect,
RGB(0, 0, 0));
}
else
{
return CDialog::OnEraseBkgnd(pDC);
}
return true; // Yes, I erased the back
}