C ++中的DwmExtendFrameIntoClientArea

时间:2012-11-18 09:09:30

标签: c++ aero aero-glass dwm

我有以下C ++代码:

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    bool fCallDWP = true;
    BOOL fDwmEnabled = FALSE;
    LRESULT lRet = 0;
    HRESULT hr = S_OK;

    MARGINS margins;

    margins.cxLeftWidth = 10;      // 8
    margins.cxRightWidth = 10;    // 8
    margins.cyBottomHeight = 10; // 20
    margins.cyTopHeight = 50;       // 27

    hr = DwmExtendFrameIntoClientArea(hWnd, &margins);
    return 0;
}

但是,当我尝试编译时,我收到以下错误:

但它不起作用。它不报告任何错误,但它只是没有显示正确的结果。

这是我的表格版画屏幕:

enter image description here

1 个答案:

答案 0 :(得分:0)

case WM_ACTIVATE: {
    DwmExtendFrameIntoClientArea(hWnd,&margins);
    break;
}
case WM_ERASEBKGND: {
    // I think your window's transparency key should be RGB(0,0,0)
    FillRect((HDC)wParam,&WndRect,CreateSolidBrush(RGB(0,0,0)));
    return TRUE;
}