子窗口的WM_CREATE的替代方法

时间:2018-07-23 08:55:44

标签: c++ winapi subclassing

我用以下老技巧将子窗口子类化:

SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)&NewWndProc);

WM_CREATE消息永远不会发送给它:

LRESULT CALLBACK NewWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    HBRUSH hBackground;

    switch (msg)
    {
        case WM_CREATE:
        // this is never received in my child window
        break;
    }
}

另一种可以替代它的消息是什么,我可以在其中初始化我打算在HBRUSHHBITMAP中使用的WM_PAINTWM_NOTIFY / NM_CUSTOMDRAW变量?

0 个答案:

没有答案