[WinAPI] Developing a color customizable program
I am trying to make my program fully color customizable. Thereīs a "Config Color" window where the user can click to open a ChooseColor common dialog to select TXT and BG color for all the controls. This color config is saved into a ini file.
Until now, i was able to change the color of all the Static Controls, ListBoxes, Edit Controls and CheckBoxes via intercepting WM_CTLCOLORSTATIC, WM_CTLCOLORLISTBOX, WM_CTLCOLOREDIT and WM_CTLCOLORBTN.
Looks good, but I got some problems thou: Thereīs really no point on changing BG and TXT color fo all the controls without changing my MainWindow BG and TABS BG.
Well i have absolutely no idea on how to change the Main Window BG color yet, so any help will be fantastic.
About changing the TABS BG color, someone told me that the only way would be to create an Owner Drawn Tab Control.
I would like to know if thereīs really no other way cause iīve never done it Owner Drawn, it will be a pain in the ass to create it.
If thereīs no other way, does anyone knows where to find a good example of how to implement and use Owner-Drawn Tabs using WinAPI? All I could find on my googling are VB and MFC examples. English is not my native language so maybe I skip something good. MSDN stuff on that was not clear enough for me.
But please, tell me thereīs an easier way :)
Just to make everything clear I am using my Tab Control like this right now:
And I am intercepting TCN_SELCHANGE at WM_NOTIFY to catch the number of the active tab and calling functions at each os this cases to Show/Hide/Enable/Disable controls at each tab change:
static int tabnumber;
hwndTab = CreateWindowEx(0, WC_TABCONTROL, "",
WS_CHILD | TCS_RIGHTJUSTIFY | TCS_MULTILINE | /WS_VISIBLE,
3, 0, 358, 383, mainWindow, (HMENU) 10, ((LPCREATESTRUCT) lParam)->hInstance, NULL);
tci.pszText = "Status:";
tci.pszText = "Servers/Logging Setup:";
tci.pszText = "Looks:";
tci.pszText = "Info:";
Once i add the 'TCS_OWNERDRAWFIXED' style to the Tab Control, the app compiles normally (with MingW, GCC 3.2) and the program works ok. The Tabs are displayed and work ok (I can change between them, so the TCN_SELCHANGE stuff is working). Only problem is that the Title in each TAB disappear and the TAB has some glitches. I really donīt know how to handle this Owner Drawn Tab...
tabnumber = TabCtrl_GetCurSel((HWND)nmptr->hwndFrom);
return DefWindowProc (mainWindow, messages, wParam, lParam);
Thatīs it, hope someone can help me on that :)