From 5004e1f284359986e5e293e694687e594f12467e Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Thu, 16 Jan 2014 00:10:01 +0000 Subject: [PATCH] "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 --- reactos/base/applications/msconfig/msconfig.c | 66 +++++++++++++++++-- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/reactos/base/applications/msconfig/msconfig.c b/reactos/base/applications/msconfig/msconfig.c index a57c212599a..69ad608ba7f 100644 --- a/reactos/base/applications/msconfig/msconfig.c +++ b/reactos/base/applications/msconfig/msconfig.c @@ -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 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);