winapi - WC_TABCONTROL

03/03/2015 07:06 Daifoku#1
Folgende Situation:
Ich habe ein WC_TABCONTROL Element und ordne jedem Tab ein STATIC Element hinzu. Diese Elemente sollen als Container dienen.

Das Anzeigen und Auswählen der statischen Elemente funktioniert wunderbar mittels WM_NOTIFY -> TCN_SELCHANGE

Ich weiß aber nicht, wie ich andere Elemente, z.B. einen Button, dem statischen Element als Child übergeben kann.

Code:
case WM_CREATE:
/* creating a WC_TABCONTROL*/
HWND hTab = CreateWindow(WC_TABCONTROL, NULL, WS_CHILD | WS_VISIBLE, ..);

/* Sending TCM_INSERTITEM to insert Tabs */
SendMessage(hTab, TCM_INSERTITEM, ...)

/*  creating a Child of hTab */
HWND hContainer = CreateWindowEx(NULL, L"STATIC", L"tab 1",WS_CHILD | WS_VISIBBLE | SS_OWNERDRAW, ..);

Adding a Button with BS_OWNERDRAW & subclassing to a tab (not working)...

Code:
/* hContainer should be the parent.. */
CreateWindowW(L"BUTTON", L"", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_OWNERDRAW, button->slot * 36, 50 + button->bag * 36, 32, 32, hContainer , button->hmenu, NULL, NULL);
button->OriginalProc = (WNDPROC)SetWindowLong(button->button, GWL_WNDPROC, (LONG)ButtonProc);
adding a Button to a tab without BS_OWNERDRAW (working..)

Code:
/* hContainer should be the parent.. */
CreateWindowW(L"BUTTON", L"", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , button->slot * 36, 50 + button->bag * 36, 32, 32, hContainer , button->hmenu, NULL, NULL);
edit ~> Solution:
I had to subclass the tabs and forward the messages :)

[Only registered and activated users can see links. Click Here To Register...]

I'm fine with it :) pure winapi, no MFC.. painting it dynamically was a pain but it works surprisingly good :)