PDA

View Full Version : Cry for Win32 help!!!!!!


Mihail121
04-06-2006, 09:22 AM
Guy, please, I'm desperate!!! I create a tab control in my application and, because I use the XP visual styles in my application, it gets the correct background color. However neither the dialog boxes I use for tabs, nor the controls on them have this background color (as it would be correct for a child window...). So the result is a very ugly tab control in which the tabs have the old gray color while the control itselfs has a white one. Could someone tell me some steps to make the background colors match? I'm using C, thank you!

Axel
04-06-2006, 03:11 PM
How did you activate the use of the new comctrl32.dll? Did you embed a manifest?

rued
04-06-2006, 04:52 PM
Hi Michail,

I think the code below is what you need!?

Talk to you
Thomas Rued

#define ETDT_DISABLE 0x00000001
#define ETDT_ENABLE 0x00000002
#define ETDT_USETABTEXTURE 0x00000004
#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)

typedef HRESULT STDAPICALLTYPE EnableThemeDialogTextureFn( HWND hwnd, DWORD dwFlags );

static HINSTANCE themeDllHandle = ::LoadLibrary( "UxTheme.dll" );

void setTabTextureAsDialogBg(HWND window)
{
if (themeDllHandle != 0)
{
EnableThemeDialogTextureFn* pEnableThemeDialogTexture = reinterpret_cast<EnableThemeDialogTextureFn*>(::GetProcAddress(themeDllHandle, "EnableThemeDialogTexture"));

if (pEnableThemeDialogTexture != NULL)
{
pEnableThemeDialogTexture(window, ETDT_ENABLETAB);
ShowWindow(window,SW_HIDE);
ShowWindow(window,SW_SHOW);
}
}
}

Mihail121
04-07-2006, 03:46 AM
Thank you, Thomas, this is exactly what I needed :yes: You saved me! :w00t: