I have created a modeless dialog box and within that dialog box a tabbed window using CreateWindowEx().
I am able to set the font for this window, but I cannot change the color. I have been advised that SetWindowLong() and SetClassLong won't work on these windows, and there is an example given on the MS help forum where they don't explain their variable and they assume MFC, etc.
So, does anyone know how to change the background color of tabbed window using the Win32 API, i.e., no MFC, ATL, CLR or anything else.
iirc (and it's been a while so I might be wrong), but CreateWindowEx has an HBRUSH parameter that is set to be the background. I know this is used for the client area in SDI windows, but it might be applicable here. Just make an HBRUSH be the color you want with CreateSolidBrush and pass it appropriately to CreateWindowEx and see if that does the trick. You'll probably have to destroy the brush too, after the window closes.
That's just a shot in the dark though. It might not work. If it doesn't, then I have no idea what else to try.
Actually, I just looked at my CreateWindowEx() and there is no HBRUSH parameter. Following is the site where MS gives an example of changing the color of tabbed windows. The problem is that they don't define all the variables so I don't know what's what. For example, they don't define hbrRed, and also since my tabbed window was created with CreateWindowEx() instead of in the RC file, I don't know what to do with their GegDlgItem(hDlg, IDC_TAB1).
Since my window is created dynamically as hTabWnd = CreateWindowEx(), I don't know how to get handle for the tab control. Here is the link...
Ack! My apologies! It was the WNDCLASSEX structure that has the HBRUSH, not CreateWindowEx. My mistake! But yeah that probably won't work.
That article seems to say exactly how to do it.
they don't define hbrRed
it's just an HBRUSH. The example on the page says that the brushes were created in WM_INITDIALOG.
and also since my tabbed window was created with CreateWindowEx() instead of in the RC file, I don't know what to do with their GegDlgItem(hDlg, IDC_TAB1)
That just gets the HWND of the tab control. You would use the HWND returned from CreateWindowEx (your hTabWnd)
Apart from that, the article seems pretty straightforward to me.
Yeah, the article is pretty straightforward; I just had to work through it before it became UN-intimidating. I'm pretty new to programming, so sometimes a bunch of code looks like a machine-gun nest. -:)