Win32 non MFC solution to have STATIC TEXT items with TRANSPARENT background
Posted on 2004-08-12
I would like to have a solution for the problem that's not written with MFC code or similiar, but uses "lo-level" Win32 apis C calls.
// create a window class with
aWc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
// create a window "on aWc" window class
hWnd = CreateWindow(WS_OVERLAPPEDWINDOW,...)
// add a text
hControl = CreateWindowEx(0,"STATIC", "Wanna be transparent", WS_VISIBLE | WS_CHILD , ....);
ShowWindow(hControl, SW_SHOW );
ShowWindow(hWnd, SW_SHOW );
[...messages loop code... ]
The result can be that the background color of the hControl is not the one specified in aWc.hbrBackground.
Also, I would like a solution that declares really the control transparent so that every control, for every color or brush
specified in aWc.hbrBackground (for instance (HBRUSH)GetStockObject(RED_BRUSH);) is drown "correctly".
I would like also that the solution works if I organize trees of child windows like...
...or if the text is put over an image control, or over other rectangular child windows which have a different background colors. So the text should be really transparent.