/** * @file XTPShellSettings.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "stdafx.h" #include "Common/XTPTypeId.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Controls/Shell/XTPShellSettings.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif const TCHAR COLORKEY[] = _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"); ////////////////////////////////////////////////////////////////////// // CXTPShellSettings CXTPShellSettings::CXTPShellSettings() { RefreshSettings(); } CXTPShellSettings::~CXTPShellSettings() { } ////////////////////////////////////////////////////////////////////// // void CXTPShellSettings::RefreshSettings() { ::ZeroMemory((SHELLFLAGSTATE*)this, sizeof(SHELLFLAGSTATE)); typedef void(WINAPI * SHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpSFS, DWORD dwMask); SHGETSETTINGSPROC SHGetSettings = NULL; static CXTPModuleHandle modShell32Dll(_T("shell32.dll")); if (modShell32Dll.LoadLibrary(_T("shell32.dll")) && modShell32Dll.GetProcAddress((FARPROC*)&SHGetSettings, "SHGetSettings")) { SHGetSettings((SHELLFLAGSTATE*)this, SSF_DESKTOPHTML | SSF_DONTPRETTYPATH | SSF_DOUBLECLICKINWEBVIEW | SSF_HIDEICONS | SSF_MAPNETDRVBUTTON | SSF_NOCONFIRMRECYCLE | SSF_SHOWALLOBJECTS | SSF_SHOWATTRIBCOL | SSF_SHOWCOMPCOLOR | SSF_SHOWEXTENSIONS | SSF_SHOWINFOTIP | SSF_SHOWSYSFILES | SSF_WIN95CLASSIC); } m_crCompColor = RGB(0x00, 0x00, 0xff); // default blue color. m_crEncrColor = RGB(0x13, 0x92, 0x0d); // default green color. HKEY hKey = NULL; if (::RegOpenKeyEx(HKEY_CURRENT_USER, COLORKEY, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { DWORD uBytes = sizeof(COLORREF); DWORD dwType = REG_BINARY; COLORREF crCompColor; COLORREF crEncrColor; // try to locate user defined compressed file color. if (::RegQueryValueEx(hKey, _T("AltColor"), NULL, &dwType, (LPBYTE)&crCompColor, &uBytes) == ERROR_SUCCESS) { m_crCompColor = crCompColor; } uBytes = sizeof(COLORREF); // try to locate user defined encrypted file color. if (::RegQueryValueEx(hKey, _T("AltEncryptionColor"), NULL, &dwType, (LPBYTE)&crEncrColor, &uBytes) == ERROR_SUCCESS) { m_crEncrColor = crEncrColor; } ::RegCloseKey(hKey); } }