Hello everyone!
I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.
I have subclassed tree view in my main window to make his background transparent, which works fine, but its items are not painted at all!
I am inexperienced in subclassing, so I ask more experienced members to help me modify following code, so I can get transparent tree view with all nodes displayed properly:
static WNDPROC wp;
LRESULT CALLBACK wpTree(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps),
hdcMem = CreateCompatibleDC(hdc);
RECT r;
GetClientRect( hWnd, &r );
HBITMAP bmp = CreateCompatibleBitmap( hdc,
r.right - r.left,
r.bottom - r.top ) ,
bmpOld;
bmpOld = (HBITMAP)SelectObject( hdcMem, bmp );
TransparentBlt( hdc, 0, 0,
r.right - r.left,
r.bottom - r.top,
hdcMem, 0, 0,
r.right - r.left,
r.bottom - r.top,
RGB( 0, 0, 0 ) );
SelectObject( hdcMem, bmpOld );
DeleteObject(bmp);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
}
return 0L;
case WM_ERASEBKGND:
return 0L;
}
return CallWindowProc( wp, hWnd, message, wParam, lParam );
}
This is how I have subclassed tree in main window procedure:
case WM_CREATE:
{
hwndTV = CreateWindowEx( ... );
wp = (WNDPROC)GetWindowLongPtr( hwndTV, GWL_WNDPROC);
SetWindowLongPtr( hwndTV, GWL_WNDPROC, (LONG)wpTree );
.
.
.
}
Code example, or snippet would be very helpful, but I would also appreciate written instructions as well
, but make them detailed please, since I am not very experienced.
I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.
That would be all, again I thank everyone who tries to help.Thank you very very much!