Question: How to make child controls transparent on a tabctrl(on a dialog), with XP themes activated? Like Preference dlg of winamp...
Asked by Dave (222.90.231.x) on August 13 2009, 5:59pm
Reply on August 13 2009, 8:33pm (edited at August 13 2009, 8:34pm):Hmm, you mean using a child dialog on the tab control?
We use something like this (sorry it is so long and verbose, it's just crap that we include and never look at again):
typedef HRESULT (WINAPI * ENABLETHEMEDIALOGTEXTURE)(HWND, DWORD);
typedef HRESULT (WINAPI * SETWINDOWTHEME)(HWND, LPCWSTR, LPCWSTR);
int IsWinXPTheme(void)
{
static int previousRet = -1;
if(previousRet == -1)
{
HINSTANCE dll = LoadLibrary(TEXT("uxtheme.dll"));
int is = 0;
if(dll)
{
FreeLibrary(dll);
is = 1;
}
previousRet = is;
return is;
}
return previousRet;
}
void DoWinXPStyle(int on, HWND tab)
{
#define ETDT_DISABLE 0x01
#define ETDT_ENABLE 0x02
#define ETDT_ENABLETAB 0x06
#define ETDT_USETABTEXTURE 0x04.
ENABLETHEMEDIALOGTEXTURE pfnETDT;
static HINSTANCE hDll = NULL;
static int trypos=0;
if(!hDll)
{
if (!trypos)
hDll = LoadLibrary(TEXT("uxtheme.dll"));
trypos=1;
}
if(hDll != NULL)
{
if(NULL != (pfnETDT = (ENABLETHEMEDIALOGTEXTURE)GetProcAddress(hDll,
"EnableThemeDialogTexture"))){
pfnETDT(tab,(on?ETDT_ENABLETAB:ETDT_DISABLE));
}
}
}
...
if (IsWinXPTheme()) DoWinXPStyle(1,somechildwindow);