Click here to Skip to main content
15,888,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
As title says, either gets printed in black either it doesn't get printed at all.

Here's how i'm creating the TabControl

C++
RECT client_rect;
		GetClientRect(hwnd, &client_rect);

		TabControl = CreateWindowEx(WS_EX_COMPOSITED, WC_TABCONTROL, L"", WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
			10, 10, client_rect.right - client_rect.left - 20, 
			client_rect.bottom - client_rect.top - 20, hwnd, (HMENU)110, GetModuleHandle(NULL), NULL);
		
		TCITEM tab_info;
		memset(&tab_info, 0, sizeof(tab_info));
		tab_info.mask = TCIF_TEXT;
		tab_info.pszText = L"Encoder";
		tab_info.cchTextMax = 5;
		SendMessage(TabControl, TCM_INSERTITEM, 0, (LPARAM)&tab_info);
		tab_info.pszText = L"Decoder";
		SendMessage(TabControl, TCM_INSERTITEM, 1, (LPARAM)&tab_info);
		tab_info.pszText = L"Info Tab  ";
		SendMessage(TabControl, TCM_INSERTITEM, 2, (LPARAM)&tab_info);
		
		RECT tab_rectangle;
		GetClientRect(TabControl, &tab_rectangle);
		SendMessage(TabControl, TCM_ADJUSTRECT, FALSE, (LPARAM)&tab_rectangle);
		DefaultTabProc = (WNDPROC)SetWindowLongPtr(TabControl, GWL_WNDPROC, (LONG_PTR)TabProc);



I tried to create this groupbox in the tabcontrol's parent window, but gets printed in black

C++
//create groupbox as child of the tabcontrol
MainGroupBox = CreateWindowEx(NULL, L"BUTTON", L"", BS_GROUPBOX | WS_CHILD | WS_GROUP | WS_VISIBLE, 20, 50, 342, 180, TabControl,
			(HMENU)NULL, GetModuleHandle(NULL), NULL);


If I try instead to create it inside the subclassed TabProc function, it doesn't get printed at all :

C++
//subclassed TabProc
case WM_CREATE:
	{
		MainGroupBox = CreateWindowEx(NULL, L"BUTTON", L"", BS_GROUPBOX | WS_CHILD | WS_GROUP | WS_VISIBLE, 10, 40, 342, 180, hwnd,
			(HMENU)NULL, GetModuleHandle(NULL), NULL);
	}


The only way to get it printed is to set it as child of the main frame window, which is undesiderable for few circumstances

Thanks in advance for every answer

EDIT : i'm using INITCOMMONCONTROLSEX to create the tabcontrol and compiling for win7
Posted
Updated 25-Dec-14 9:59am
v2
Comments
[no name] 26-Dec-14 12:53pm    
Try turning off WS_EX_COMPOSITED.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900