I am working on a Win32 graphical application using the simple Win32 API (without MFC or .NET). The problem I am facing is that the controls look transparent. I came up with a method that works for most things, in Windows Vista + I do this in WndProc:
case WM_CTLCOLORSTATIC:
{
SetBkMode((HDC)wParam, TRANSPARENT);
return (INT_PTR)::GetStockObject(NULL_PEN);
}
break;
In Windows XP, I do this in WndProc:
case WM_CTLCOLORSTATIC:
{
HBRUSH hbr = (HBRUSH)DefWindowProc(hDlg, message, wParam, lParam);
::DeleteObject(hbr);
SetBkMode((HDC)wParam, TRANSPARENT);
return (LRESULT)(HBRUSH)(COLOR_WINDOW);
}
Now this works for most controls, however I get a transparent background on the label at the top of the group box control, which draws a line in the group box through text. I started working on the case only for group boxes, but I am sure that this is a problem that must have been resolved earlier, and I do not want to reinvent the wheel again.
?
,
J