mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Weather: Maintain handle to uxtheme for the lifetime of the instance
This commit is contained in:
parent
71656419f7
commit
97e522cf34
@ -530,6 +530,10 @@ ULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this)
|
||||
CloseHandle(_this->hMutexData);
|
||||
}
|
||||
|
||||
if (_this->hUxtheme)
|
||||
{
|
||||
FreeLibrary(_this->hUxtheme);
|
||||
}
|
||||
FREE(_this);
|
||||
LONG dwOutstandingObjects = InterlockedDecrement(&epw_OutstandingObjects);
|
||||
LONG dwOutstandingLocks = InterlockedAdd(&epw_LockCount, 0);
|
||||
@ -1101,14 +1105,14 @@ HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName
|
||||
|
||||
InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);
|
||||
|
||||
HMODULE hUxtheme = GetModuleHandleW(L"uxtheme.dll");
|
||||
if (hUxtheme)
|
||||
_this->hUxtheme = LoadLibraryW(L"uxtheme.dll");
|
||||
if (_this->hUxtheme)
|
||||
{
|
||||
RefreshImmersiveColorPolicyState = GetProcAddress(hUxtheme, (LPCSTR)104);
|
||||
SetPreferredAppMode = GetProcAddress(hUxtheme, (LPCSTR)135);
|
||||
AllowDarkModeForWindow = GetProcAddress(hUxtheme, (LPCSTR)133);
|
||||
ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)132);
|
||||
ShouldSystemUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)138);
|
||||
RefreshImmersiveColorPolicyState = GetProcAddress(_this->hUxtheme, (LPCSTR)104);
|
||||
SetPreferredAppMode = GetProcAddress(_this->hUxtheme, (LPCSTR)135);
|
||||
AllowDarkModeForWindow = GetProcAddress(_this->hUxtheme, (LPCSTR)133);
|
||||
ShouldAppsUseDarkMode = GetProcAddress(_this->hUxtheme, (LPCSTR)132);
|
||||
ShouldSystemUseDarkMode = GetProcAddress(_this->hUxtheme, (LPCSTR)138);
|
||||
if (ShouldAppsUseDarkMode &&
|
||||
ShouldSystemUseDarkMode &&
|
||||
SetPreferredAppMode &&
|
||||
|
@ -60,6 +60,7 @@ typedef interface EPWeather
|
||||
char* pImage;
|
||||
DWORD cbLocation;
|
||||
LPCWSTR wszLocation;
|
||||
HMODULE hUxtheme;
|
||||
|
||||
RECT rcBorderThickness; // local variables:
|
||||
ITaskbarList* pTaskList;
|
||||
|
Loading…
Reference in New Issue
Block a user