"Hack" to fix colors in themed mode in Windows AND ReactOS.

Taken from WinSpy++ (http://www.catch22.net/software/winspy) by J Brown

svn path=/trunk/; revision=61641
This commit is contained in:
Daniel Reimer 2014-01-16 00:10:01 +00:00
parent 6360f5452f
commit 5004e1f284

View file

@ -25,18 +25,72 @@ HICON hDialogIcon = NULL;
void MsConfig_OnTabWndSelChange(void);
////////////////////////////////////////////////////////////////////////////////
// Taken from WinSpy++ 1.7
// http://www.catch22.net/software/winspy
// Copyright (c) 2002 by J Brown
//
//
// Copied from uxtheme.h
// If you have this new header, then delete these and
// #include <uxtheme.h> instead!
//
#define ETDT_DISABLE 0x00000001
#define ETDT_ENABLE 0x00000002
#define ETDT_USETABTEXTURE 0x00000004
#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
//
typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
//
// Try to call EnableThemeDialogTexture, if uxtheme.dll is present
//
BOOL EnableDialogTheme(HWND hwnd)
{
HMODULE hUXTheme;
ETDTProc fnEnableThemeDialogTexture;
hUXTheme = LoadLibrary(_T("uxtheme.dll"));
if(hUXTheme)
{
fnEnableThemeDialogTexture =
(ETDTProc)GetProcAddress(hUXTheme, "EnableThemeDialogTexture");
if(fnEnableThemeDialogTexture)
{
fnEnableThemeDialogTexture(hwnd, ETDT_ENABLETAB);
FreeLibrary(hUXTheme);
return TRUE;
}
else
{
// Failed to locate API!
FreeLibrary(hUXTheme);
return FALSE;
}
}
else
{
// Not running under XP? Just fail gracefully
return FALSE;
}
}
BOOL OnCreate(HWND hWnd)
{
TCHAR szTemp[256];
TCITEM item;
hTabWnd = GetDlgItem(hWnd, IDC_TAB);
hGeneralPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_GENERAL_PAGE), hWnd, GeneralPageWndProc);
hSystemPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SYSTEM_PAGE), hWnd, SystemPageWndProc);
hFreeLdrPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FREELDR_PAGE), hWnd, FreeLdrPageWndProc);
hServicesPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SERVICES_PAGE), hWnd, ServicesPageWndProc);
hStartupPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_STARTUP_PAGE), hWnd, StartupPageWndProc);
hToolsPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TOOLS_PAGE), hWnd, ToolsPageWndProc);
hGeneralPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_GENERAL_PAGE), hWnd, GeneralPageWndProc); EnableDialogTheme(hGeneralPage);
hSystemPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SYSTEM_PAGE), hWnd, SystemPageWndProc); EnableDialogTheme(hSystemPage);
hFreeLdrPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FREELDR_PAGE), hWnd, FreeLdrPageWndProc); EnableDialogTheme(hFreeLdrPage);
hServicesPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SERVICES_PAGE), hWnd, ServicesPageWndProc); EnableDialogTheme(hServicesPage);
hStartupPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_STARTUP_PAGE), hWnd, StartupPageWndProc); EnableDialogTheme(hStartupPage);
hToolsPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TOOLS_PAGE), hWnd, ToolsPageWndProc); EnableDialogTheme(hToolsPage);
LoadString(hInst, IDS_MSCONFIG, szTemp, 256);
SetWindowText(hWnd, szTemp);