WM_ERASEBKGND事件处理程序默认实现

时间:2015-09-04 23:17:09

标签: c winapi

有谁知道WM_ERASEBKGND消息的事件处理程序的默认实现(源代码)是什么?

1 个答案:

答案 0 :(得分:2)

它基本上是这样的:

case WM_ERASEBKGND:
{
    HBRUSH hBsh = reinterpret_cast<HBRUSH>(GetClassLongPtr(hWnd, GCL_HBRBACKGROUND));
    if (!hBsh) return FALSE;

    RECT rc;
    GetClientRect(hWnd, &rc);
    FillRect(reinterpret_cast<HDC>(wParam), &rc, hBsh);
    return TRUE;
}