taro-x@justsystem.co.jp wrote:
@@ -2665,12 +2665,27 @@ static LRESULT TREEVIEW_EraseBackground(TREEVIEW_INFO *infoPtr, HDC hDC) {
- HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
- RECT rect;
- HBRUSH hBrushLocal = NULL;
- HWND hwnd = infoPtr->hwnd;
- HBRUSH hBrush = (HBRUSH)SendMessageW(GetParent(hwnd),
IsWindowEnabled(hwnd) ? WM_CTLCOLOREDIT : WM_CTLCOLORSTATIC,
- (WPARAM)hDC, (LPARAM)hwnd);
- if (!hBrush)
- {
- hBrushLocal = CreateSolidBrush(GetBkColor(hDC));
- hBrush = hBrushLocal;
- }
1. treeview has hwndNotify for sending notification messages, WM_CTLxxx messages can be sent to it as well.
2. In the case SendMessage(WM_CTLxxx) returns 0 (i.e. an app doesn't call DefWindowProc) you have to call DefWindowProc(WM_CTLxxx) yourself and not create an arbitrary brush.
3. Do not use C++ style comments.