1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

Weather: Widget supports dark mode (thanks @krlvm) (#755)

This commit is contained in:
Valentin Radu 2022-01-31 02:30:34 +02:00
parent 94c604bde5
commit 74204c7e84
12 changed files with 370 additions and 64 deletions

View File

@ -16,6 +16,7 @@ Tested on OS build 22000.434.
* Possibility to disable the icon in the weather widget (.1)
* The weather widget defaults to showing in the preferred language set in Windows, instead of English (#734) (.2)
* The weather widget shows an error screen when an error happens (like, using an incorrect location, or the network not working etc) (.3)
* The weather widget supports dark mode (thanks @krlvm) (#755) (.4)
#### Fixes

View File

@ -108,6 +108,8 @@ DWORD dwWeatherViewMode = EP_WEATHER_VIEW_ICONTEXT;
DWORD dwWeatherTemperatureUnit = EP_WEATHER_TUNIT_CELSIUS;
DWORD dwWeatherUpdateSchedule = EP_WEATHER_UPDATE_NORMAL;
DWORD bWeatherFixedSize = FALSE;
DWORD dwWeatherTheme = 0;
DWORD dwWeatherGeolocationMode = 0;
WCHAR* wszWeatherTerm = NULL;
WCHAR* wszWeatherLanguage = NULL;
WCHAR* wszEPWeatherKillswitch = NULL;
@ -3733,9 +3735,9 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
RECT rcWeatherFlyoutWindow;
rcWeatherFlyoutWindow.left = mi.rcWork.left;
rcWeatherFlyoutWindow.top = mi.rcWork.top;
rcWeatherFlyoutWindow.right = rcWeatherFlyoutWindow.left + MulDiv(EP_WEATHER_HEIGHT, dpiX, 96);
rcWeatherFlyoutWindow.bottom = rcWeatherFlyoutWindow.top + MulDiv(EP_WEATHER_WIDTH, dpiX, 96);
if (FAILED(epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, rcWeatherFlyoutWindow, &hWndWeatherFlyout)))
rcWeatherFlyoutWindow.right = rcWeatherFlyoutWindow.left + MulDiv(EP_WEATHER_WIDTH, dpiX, 96);
rcWeatherFlyoutWindow.bottom = rcWeatherFlyoutWindow.top + MulDiv(EP_WEATHER_HEIGHT, dpiX, 96);
if (FAILED(epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, rcWeatherFlyoutWindow, dwWeatherTheme, dwWeatherGeolocationMode, &hWndWeatherFlyout)))
{
epw->lpVtbl->Release(epw);
}
@ -5542,6 +5544,42 @@ void WINAPI LoadSettings(LPARAM lParam)
{
dwRefreshUIMask |= REFRESHUI_PEOPLE;
}
DWORD dwOldWeatherTheme = dwWeatherTheme;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherTheme"),
0,
NULL,
&dwWeatherTheme,
&dwSize
);
if (dwWeatherTheme != dwOldWeatherTheme && PeopleButton_LastHWND)
{
if (epw)
{
epw->lpVtbl->SetDarkMode(epw, (LONG64)dwWeatherTheme, TRUE);
}
}
DWORD dwOldWeatherGeolocationMode = dwWeatherGeolocationMode;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherLocationType"),
0,
NULL,
&dwWeatherGeolocationMode,
&dwSize
);
if (dwWeatherGeolocationMode != dwOldWeatherGeolocationMode && PeopleButton_LastHWND)
{
if (epw)
{
epw->lpVtbl->SetGeolocationMode(epw, (LONG64)dwWeatherGeolocationMode);
}
}
#endif
dwTemp = TASKBARGLOMLEVEL_DEFAULT;

View File

@ -375,13 +375,22 @@
;x 1 Fahrenheit
"WeatherTemperatureUnit"=dword:00000000
;w Location
;Search City or Zip Code; the program looks up "weather in /* what you typed */" on Google. Leave blank for the default value (IP-based current location).
;Search City or Zip Code; the program looks up "weather in /* what you typed */" on Google. Leave blank for the default value (current location).
;Current location (default)
"WeatherLocation"=""
;;;c 2 Location accuracy
;;;x 0 Generic (based on the IP address) (default)
;;;x 1 Precise (geolocation)
;;"WeatherLocationType"=dword:00000000
;w Language
;Type the short code for the language you'd like the weather data to be displayed in. For example, try "en", "ro", "de", "fr" etc. Leave blank for the default value (English).
;en (default)
"WeatherLanguage"=""
;c 3 Color scheme
;x 0 Follow system setting (default)
;x 1 Light
;x 2 Dark
"WeatherTheme"=dword:00000000
;q
;t Weather data courtesy of Google, and weather.com.
;y Learn more about the Weather taskbar widget 🡕

View File

@ -6,6 +6,12 @@ HMODULE epw_hModule;
DWORD epw_OutstandingObjects = 0;
DWORD epw_LockCount = 0;
void(*RefreshImmersiveColorPolicyState)();
void(*SetPreferredAppMode)(INT64 bAllowDark);
void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);
BOOL(*ShouldAppsUseDarkMode)();
BOOL(*ShouldSystemUseDarkMode)();
#ifdef _WIN64
#pragma comment(linker, "/export:DllRegisterServer=_DllRegisterServer")
#else

View File

@ -50,7 +50,8 @@ DEFINE_GUID(IID_IEPWeather,
#define EP_WEATHER_UPDATE_REDUCED 3600
#define EP_WEATHER_WM_FETCH_DATA (WM_USER + 10)
#define EP_WEATHER_WM_SET_BROWSER_THEME (WM_USER + 11)
#define EP_WEATHER_WIDTH 425
#define EP_WEATHER_HEIGHT 690
#define EP_WEATHER_HEIGHT 391
#define EP_WEATHER_WIDTH 690
#endif

View File

@ -7,6 +7,7 @@ LPCWSTR ep_weather_error_html = L"\
<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n\
<head>\n\
<meta charset=\"utf-8\" />\n\
<meta name=\"color-scheme\" content=\"light dark\">\n\
<title>Weather</title>\n\
<style>\n\
html {\n\
@ -23,7 +24,7 @@ body {\n\
<body><center>\n\
<h1>&#128240;</h1>\n\
<h2>Unable to load weather information</h2>\n\
<p>Check to make sure that the location you have entered is correct.<br/>\n\
<p>Make sure that the location you have entered is correct.<br/>\n\
Verify that you are connected to the Internet.</p>\n\
</center></body>\n\
</html>";

View File

@ -105,6 +105,7 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2EnvironmentCompleted(I
HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)
{
_ep_weather_ReboundBrowser(_this, TRUE);
InterlockedExchange64(&_this->bIsNavigatingToError, TRUE);
UINT dpi = GetDpiForWindow(_this->hWnd);
int ch = MulDiv(305, dpi, 96);
@ -113,12 +114,6 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)
if (rc.bottom - rc.top != ch)
{
SetWindowPos(_this->hWnd, NULL, 0, 0, rc.right - rc.left, ch, SWP_NOMOVE | SWP_NOSENDCHANGING);
RECT bounds;
GetClientRect(_this->hWnd, &bounds);
if (_this->pCoreWebView2Controller)
{
_this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);
}
HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);
if (hNotifyWnd)
{
@ -137,6 +132,7 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)
HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToProvider(EPWeather* _this)
{
_ep_weather_ReboundBrowser(_this, FALSE);
HRESULT hr = S_OK;
LONG64 dwProvider = InterlockedAdd64(&_this->dwProvider, 0);
if (dwProvider == EP_WEATHER_PROVIDER_TEST)
@ -148,10 +144,10 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToProvider(EPWeather* _this)
_this->wszScriptData = malloc(sizeof(WCHAR) * EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN);
if (_this->wszScriptData)
{
swprintf_s(_this->wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN, ep_weather_provider_google_html, _this->wszLanguage, _this->wszTerm[0] ? L" " : L"", _this->wszTerm);
swprintf_s(_this->wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN, L"https://www.google.com/search?hl=%s&q=weather%s%s", _this->wszLanguage, _this->wszTerm[0] ? L" " : L"", _this->wszTerm);
if (_this->pCoreWebView2)
{
hr = _this->pCoreWebView2->lpVtbl->NavigateToString(_this->pCoreWebView2, _this->wszScriptData);
hr = _this->pCoreWebView2->lpVtbl->Navigate(_this->pCoreWebView2, _this->wszScriptData);
}
else
{
@ -203,12 +199,34 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_ExecuteDataScript(EPWeather* _this)
}
else
{
hr = E_OUTOFMEMORY;
hr = E_OUTOFMEMORY;
}
}
return hr;
}
HRESULT STDMETHODCALLTYPE _ep_weather_ReboundBrowser(EPWeather* _this, LONG64 dwType)
{
UINT dpi = GetDpiForWindow(_this->hWnd);
RECT bounds;
if (dwType)
{
GetClientRect(_this->hWnd, &bounds);
}
else
{
bounds.left = 0 - MulDiv(167, dpi, 96);
bounds.top = 0 - MulDiv(178, dpi, 96);
bounds.right = 5560;
bounds.bottom = 15600;
}
if (_this->pCoreWebView2Controller)
{
_this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler* _this2, HRESULT hr, ICoreWebView2Controller* pCoreWebView2Controller)
{
EPWeather* _this = EPWeather_Instance; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);
@ -219,9 +237,7 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
_this->pCoreWebView2Controller->lpVtbl->AddRef(_this->pCoreWebView2Controller);
}
RECT bounds;
GetClientRect(_this->hWnd, &bounds);
_this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);
_ep_weather_ReboundBrowser(_this, FALSE);
ICoreWebView2Controller2* pCoreWebView2Controller2 = NULL;
_this->pCoreWebView2Controller->lpVtbl->QueryInterface(_this->pCoreWebView2Controller, &IID_ICoreWebView2Controller2, &pCoreWebView2Controller2);
@ -244,7 +260,8 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
pCoreWebView2Settings->lpVtbl->QueryInterface(pCoreWebView2Settings, &IID_ICoreWebView2Settings6, &pCoreWebView2Settings6);
if (pCoreWebView2Settings6)
{
pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, FALSE);
//pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, FALSE);
//pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_IsStatusBarEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_IsZoomControlEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_IsGeneralAutofillEnabled(pCoreWebView2Settings6, FALSE);
@ -252,13 +269,17 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
pCoreWebView2Settings6->lpVtbl->put_IsPinchZoomEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_IsSwipeNavigationEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, FALSE);
pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);
}
pCoreWebView2Settings->lpVtbl->Release(pCoreWebView2Settings);
}
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);
_this->pCoreWebView2->lpVtbl->add_PermissionRequested(_this->pCoreWebView2, &EPWeather_ICoreWebView2PermissionRequestedEventHandler, &_this->tkOnPermissionRequested);
_this->pCoreWebView2->lpVtbl->add_NavigationCompleted(_this->pCoreWebView2, &EPWeather_ICoreWebView2NavigationCompletedEventHandler, &_this->tkOnNavigationCompleted);
_epw_Weather_NavigateToProvider(_this);
@ -266,6 +287,26 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
return S_OK;
}
HRESULT STDMETHODCALLTYPE ICoreWebView2_CallDevToolsProtocolMethodCompleted(ICoreWebView2CallDevToolsProtocolMethodCompletedHandler* _this, HRESULT errorCode, LPCWSTR returnObjectAsJson)
{
if (EPWeather_Instance)
{
wprintf(L"[CallDevToolsProtocolMethodCompleted] 0x%x [[ %s ]]\n", errorCode, returnObjectAsJson);
PostMessageW(EPWeather_Instance->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
LPWSTR uri = NULL;
if (EPWeather_Instance->pCoreWebView2)
{
EPWeather_Instance->pCoreWebView2->lpVtbl->get_Source(EPWeather_Instance->pCoreWebView2, &uri);
}
if (wcscmp(L"about:blank", uri ? uri : L""))
{
SetTimer(EPWeather_Instance->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY, NULL);
}
CoTaskMemFree(uri);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationCompleted(ICoreWebView2NavigationCompletedEventHandler* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationCompletedEventArgs* pCoreWebView2NavigationCompletedEventArgs)
{
EPWeather* _this = EPWeather_Instance; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);
@ -311,9 +352,22 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2Exec
//_this->pCoreWebView2->lpVtbl->OpenDevToolsWindow(_this->pCoreWebView2);
//printf("running part 2\n");
//LONG64 bEnabled, dwDarkMode;
//dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
//epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);
//swprintf_s(_this->wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, ep_weather_provider_google_script2, bEnabled ? 1 : 0);
_this->pCoreWebView2->lpVtbl->ExecuteScript(_this->pCoreWebView2, ep_weather_provider_google_script2, &EPWeather_ICoreWebView2ExecuteScriptCompletedHandler);
bOk = TRUE;
}
else if (!_wcsicmp(pResultObjectAsJson, L"\"run_part_1\""))
{
free(_this->wszScriptData);
_this->wszScriptData = NULL;
printf("consent granted\n");
PostMessageW(EPWeather_Instance->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
SetTimer(EPWeather_Instance->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY, NULL);
return S_OK;
}
else
{
free(_this->wszScriptData);
@ -404,7 +458,7 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2Exec
bOk = TRUE;
}
int h = _wtoi(wszHeight);
int ch = MulDiv(h, EP_WEATHER_WIDTH, 367);
int ch = MulDiv(h, EP_WEATHER_HEIGHT, 367);
UINT dpi = GetDpiForWindow(_this->hWnd);
ch = MulDiv(ch, dpi, 96);
RECT rc;
@ -412,9 +466,7 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2Exec
if (rc.bottom - rc.top != ch)
{
SetWindowPos(_this->hWnd, NULL, 0, 0, rc.right - rc.left, ch, SWP_NOMOVE | SWP_NOSENDCHANGING);
RECT bounds;
GetClientRect(_this->hWnd, &bounds);
_this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);
_ep_weather_ReboundBrowser(_this, FALSE);
HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);
if (hNotifyWnd)
{
@ -448,6 +500,19 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2Exec
return S_OK;
}
HRESULT STDMETHODCALLTYPE ICoreWebView2_PermissionRequested(ICoreWebView2PermissionRequestedEventHandler* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2PermissionRequestedEventArgs* pCoreWebView2PermissionRequestedEventArgs)
{
COREWEBVIEW2_PERMISSION_KIND kind;
pCoreWebView2PermissionRequestedEventArgs->lpVtbl->get_PermissionKind(pCoreWebView2PermissionRequestedEventArgs, &kind);
if (kind == COREWEBVIEW2_PERMISSION_KIND_GEOLOCATION)
{
DWORD r = InterlockedAdd64(&EPWeather_Instance->dwGeolocationMode, 0);
printf("[Permissions] Geolocation permission request: %d\n", r);
pCoreWebView2PermissionRequestedEventArgs->lpVtbl->put_State(pCoreWebView2PermissionRequestedEventArgs, r ? COREWEBVIEW2_PERMISSION_STATE_ALLOW : COREWEBVIEW2_PERMISSION_STATE_DENY);
}
return S_OK;
}
ULONG STDMETHODCALLTYPE epw_Weather_AddRef(EPWeather* _this)
{
return InterlockedIncrement64(&(_this->cbCount));
@ -558,6 +623,11 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
KillTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REPAINT);
return 0;
}
else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_REQUEST_REFRESH)
{
KillTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH);
return SendMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
}
else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_SCHEDULE_REFRESH)
{
if (SendMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0))
@ -577,12 +647,13 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_REBOUND_BROWSER)
{
RECT bounds;
GetClientRect(_this->hWnd, &bounds);
if (_this->pCoreWebView2Controller)
LPWSTR uri = NULL;
if (_this->pCoreWebView2)
{
_this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);
_this->pCoreWebView2->lpVtbl->get_Source(_this->pCoreWebView2, &uri);
}
_ep_weather_ReboundBrowser(_this, !wcscmp(L"about:blank", uri ? uri : L""));
CoTaskMemFree(uri);
KillTimer(_this->hWnd, EP_WEATHER_TIMER_REBOUND_BROWSER);
return 0;
}
@ -595,19 +666,38 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
return HRESULT_FROM_WIN32(ERROR_BUSY);
}
else if (uMsg == EP_WEATHER_WM_SET_BROWSER_THEME)
{
if (_this->pCoreWebView2)
{
if (lParam)
{
EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler.lpVtbl->Invoke = ICoreWebView2_CallDevToolsProtocolMethodCompleted;
}
else
{
EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler.lpVtbl->Invoke = epw_Weather_static_Stub;
}
if (wParam)
{
printf("[SetDarkMode] 1\n");
_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L"Emulation.setEmulatedMedia", L"{\"features\": [ { \"name\": \"prefers-color-scheme\", \"value\": \"dark\" }]}", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);
//_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L"Emulation.setAutoDarkModeOverride", L"{\"enabled\": true}", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);
}
else
{
printf("[SetDarkMode] 0\n");
_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L"Emulation.setEmulatedMedia", L"{\"features\": [ { \"name\": \"prefers-color-scheme\", \"value\": \"light\" }]}", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);
//_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L"Emulation.setAutoDarkModeOverride", L"{\"enabled\": false}", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);
}
return S_OK;
}
}
else if (uMsg == WM_CLOSE || (uMsg == WM_KEYUP && wParam == VK_ESCAPE) || (uMsg == WM_ACTIVATEAPP && wParam == FALSE && GetAncestor(GetForegroundWindow(), GA_ROOT) != _this->hWnd))
{
epw_Weather_Hide(_this);
return 0;
}
else if (uMsg == WM_NCHITTEST)
{
LRESULT lRes = DefWindowProcW(hWnd, uMsg, wParam, lParam);
if (lRes == HTCAPTION)
{
return HTCLIENT;
}
}
else if (uMsg == WM_WINDOWPOSCHANGING)
{
if (IsWindowVisible(hWnd))
@ -617,8 +707,28 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
return 0;
}
else if (uMsg == WM_SETTINGCHANGE)
{
if (IsColorSchemeChangeMessage(lParam))
{
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
if (!dwDarkMode)
{
epw_Weather_SetDarkMode(_this, dwDarkMode, TRUE);
}
return 0;
}
}
else if (uMsg == WM_DPICHANGED)
{
UINT dpiX = LOWORD(wParam);
int w = MulDiv(EP_WEATHER_WIDTH, dpiX, 96);
RECT* rc = lParam;
SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, w, rc->bottom - rc->top, 0);
return 0;
}
BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();
/*BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();
if (uMsg == WM_CREATE)
{
if (bIsRunningWithoutVisualStyle)
@ -681,10 +791,52 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
{
return 0;
}
}
}*/
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
HRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64* bEnabled)
{
BOOL bIsCompositionEnabled = TRUE;
DwmIsCompositionEnabled(&bIsCompositionEnabled);
if (!dwDarkMode)
{
*bEnabled = bIsCompositionEnabled && (ShouldSystemUseDarkMode ? ShouldSystemUseDarkMode() : FALSE) && !IsHighContrast();
}
else
{
*bEnabled = dwDarkMode - 1;
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64 bRefresh)
{
LONG64 bEnabled;
epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);
InterlockedExchange64(&_this->g_darkModeEnabled, dwDarkMode);
if ((dwDarkMode == 2 && bEnabled) || (dwDarkMode == 1 && !bEnabled) || !dwDarkMode)
{
RefreshImmersiveColorPolicyState();
if (_this->hWnd)
{
AllowDarkModeForWindow(_this->hWnd, bEnabled);
DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &bEnabled, sizeof(BOOL));
//InvalidateRect(_this->hWnd, NULL, FALSE);
PostMessageW(_this->hWnd, EP_WEATHER_WM_SET_BROWSER_THEME, bEnabled, bRefresh);
}
return S_OK;
}
return E_FAIL;
}
HRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG64 dwGeolocationMode)
{
InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);
PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
return S_OK;
}
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
{
HRESULT hr = S_OK;
@ -753,6 +905,8 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
BOOL value = 1;
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);
InterlockedExchange64(&_this->bBrowserBusy, TRUE);
@ -890,7 +1044,7 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
return 0;
}
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, HWND* hWnd)
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, DWORD dwGeolocationMode, HWND* hWnd)
{
if (bAllocConsole)
{
@ -941,6 +1095,28 @@ HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName
return E_INVALIDARG;
}
InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);
HMODULE hUxtheme = GetModuleHandleW(L"uxtheme.dll");
if (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);
if (ShouldAppsUseDarkMode &&
ShouldSystemUseDarkMode &&
SetPreferredAppMode &&
AllowDarkModeForWindow &&
RefreshImmersiveColorPolicyState
)
{
SetPreferredAppMode(TRUE);
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);
}
}
_this->hMutexData = CreateMutexW(NULL, FALSE, NULL);
if (!_this->hMutexData)
{

View File

@ -24,6 +24,8 @@ DEFINE_GUID(IID_ITaskbarList,
#define EP_WEATHER_TIMER_REQUEST_REPAINT_DELAY 1000
#define EP_WEATHER_TIMER_REBOUND_BROWSER 2
#define EP_WEATHER_TIMER_REBOUND_BROWSER_DELAY 1
#define EP_WEATHER_TIMER_REQUEST_REFRESH 10
#define EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY 2000
#define EP_WEATHER_TIMER_SCHEDULE_REFRESH 10
typedef interface EPWeather
@ -45,6 +47,8 @@ typedef interface EPWeather
LONG64 cby; // interlocked
LONG64 dwProvider; // interlocked
LONG64 bIsNavigatingToError; // interlocked
LONG64 g_darkModeEnabled; // interlocked
LONG64 dwGeolocationMode;
HANDLE hMutexData; // protects the following:
DWORD cbTemperature;
@ -63,6 +67,7 @@ typedef interface EPWeather
ICoreWebView2Controller* pCoreWebView2Controller;
ICoreWebView2* pCoreWebView2;
EventRegistrationToken* tkOnNavigationCompleted;
EventRegistrationToken* tkOnPermissionRequested;
LPCWSTR wszScriptData;
RECT rc;
@ -75,7 +80,7 @@ ULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_QueryInterface(EPWeather* _this, REFIID riid, void** ppv);
HRESULT STDMETHODCALLTYPE epw_Weather_About(EPWeather* _this, HWND hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, HWND* hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_Hide(EPWeather* _this);
@ -95,6 +100,9 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetTerm(EPWeather* _this, DWORD cbTerm, LP
HRESULT STDMETHODCALLTYPE epw_Weather_SetLanguage(EPWeather* _this, DWORD cbLanguage, LPCWSTR wszLanguage);
HRESULT STDMETHODCALLTYPE epw_Weather_SetIconSize(EPWeather* _this, LONG64 cbx, LONG64 cby);
HRESULT STDMETHODCALLTYPE epw_Weather_GetIconSize(EPWeather* _this, LONG64* cbx, LONG64* cby);
HRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64 bRefresh);
HRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64* bEnabled);
HRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG64 dwGeolocationMode);
static const IEPWeatherVtbl IEPWeather_Vtbl = {
.QueryInterface = epw_Weather_QueryInterface,
@ -118,6 +126,8 @@ static const IEPWeatherVtbl IEPWeather_Vtbl = {
.SetIconSize = epw_Weather_SetIconSize,
.GetIconSize = epw_Weather_GetIconSize,
.SetUpdateSchedule = epw_Weather_SetUpdateSchedule,
.SetDarkMode = epw_Weather_SetDarkMode,
.SetGeolocationMode = epw_Weather_SetGeolocationMode,
};
HRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this);
@ -133,6 +143,10 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_get_Language(ICoreWebView2EnvironmentOpt
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_TargetCompatibleBrowserVersion(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount(ICoreWebView2EnvironmentOptions* _this, BOOL* allow);
HRESULT STDMETHODCALLTYPE ICoreWebView2_CallDevToolsProtocolMethodCompleted(ICoreWebView2CallDevToolsProtocolMethodCompletedHandler* _this, HRESULT errorCode, LPCWSTR returnObjectAsJson);
HRESULT STDMETHODCALLTYPE ICoreWebView2_PermissionRequested(ICoreWebView2PermissionRequestedEventHandler* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2PermissionRequestedEventArgs* pCoreWebView2PermissionRequestedEventArgs);
static const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
@ -141,7 +155,7 @@ static const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl EPWe
};
static const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler = {
&EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl
.lpVtbl = &EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl
};
static const ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl = {
@ -152,7 +166,7 @@ static const ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl EPWea
};
static const ICoreWebView2CreateCoreWebView2ControllerCompletedHandler EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandler = {
&EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl
.lpVtbl = &EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl
};
static const ICoreWebView2NavigationCompletedEventHandlerVtbl EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl = {
@ -163,7 +177,7 @@ static const ICoreWebView2NavigationCompletedEventHandlerVtbl EPWeather_ICoreWeb
};
static const ICoreWebView2NavigationCompletedEventHandler EPWeather_ICoreWebView2NavigationCompletedEventHandler = {
&EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl
.lpVtbl = &EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl
};
static const ICoreWebView2ExecuteScriptCompletedHandlerVtbl EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl = {
@ -174,7 +188,7 @@ static const ICoreWebView2ExecuteScriptCompletedHandlerVtbl EPWeather_ICoreWebVi
};
static const ICoreWebView2ExecuteScriptCompletedHandler EPWeather_ICoreWebView2ExecuteScriptCompletedHandler = {
&EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl
.lpVtbl = &EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl
};
static const ICoreWebView2EnvironmentOptionsVtbl EPWeather_ICoreWebView2EnvironmentOptionsVtbl = {
@ -192,7 +206,29 @@ static const ICoreWebView2EnvironmentOptionsVtbl EPWeather_ICoreWebView2Environm
};
static const ICoreWebView2EnvironmentOptions EPWeather_ICoreWebView2EnvironmentOptions = {
&EPWeather_ICoreWebView2EnvironmentOptionsVtbl
.lpVtbl = &EPWeather_ICoreWebView2EnvironmentOptionsVtbl
};
static ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_CallDevToolsProtocolMethodCompleted
};
static const ICoreWebView2CallDevToolsProtocolMethodCompletedHandler EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler = {
.lpVtbl = &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl
};
static const ICoreWebView2PermissionRequestedEventHandlerVtbl EPWeather_ICoreWebView2PermissionRequestedEventHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_PermissionRequested,
};
static const ICoreWebView2PermissionRequestedEventHandler EPWeather_ICoreWebView2PermissionRequestedEventHandler = {
.lpVtbl = &EPWeather_ICoreWebView2PermissionRequestedEventHandlerVtbl
};
HRESULT STDMETHODCALLTYPE INetworkListManagerEvents_QueryInterface(void* _this, REFIID riid, void** ppv);

View File

@ -4,6 +4,18 @@
// many thanks to https://stackoverflow.com/questions/23202966/google-weather-widget-on-my-website
#define EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN 4000
LPCWSTR ep_weather_provider_google_script = L"\
function changeCSSStyle(ssMain, selector, cssProp, cssVal) {\n\
var cssRules = (document.all) ? 'rules': 'cssRules'; \n\
//console.log(ssMain);\n\
for (i=0, len=document.styleSheets[ssMain][cssRules].length; i<len; i++)\n\
{\n\
if (document.styleSheets[ssMain][cssRules][i].selectorText === selector) {\n\
document.styleSheets[ssMain][cssRules][i].style[cssProp] = cssVal; \n\
//console.log('DA');\n\
return; \n\
}\n\
}\n\
}\n\
function ep_weather_utf8ToHex(str) {\n\
return Array.from(str).map(c => \n\
c.charCodeAt(0) < 128 ? c.charCodeAt(0).toString(16) : \n\
@ -51,27 +63,27 @@ function ep_weather_getData(imageBitmap, ch) {\n\
}\n\
}\n\
let res = (\n\
document.getElementById(\"frame\").contentWindow.document.getElementsByClassName(\"ULSxyf\")[0].offsetHeight + \"#\" + \n\
document.getElementById(\"frame\").contentWindow.document.getElementById(ch.includes('x') ? \"wob_ttm\" : \"wob_tm\").innerText + \"#\" + \n\
Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t').filter(e => !e.style.display.toString().includes(\"none\"))[0].innerText + \"#\" + \n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"wob_tci\").alt + \"#\" + \n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"wob_loc\").innerText + \"#\" + \n\
document.getElementsByClassName(\"ULSxyf\")[0].offsetHeight + \"#\" + \n\
document.getElementById(ch.includes('x') ? \"wob_ttm\" : \"wob_tm\").innerText + \"#\" + \n\
Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t').filter(e => !e.style.display.toString().includes(\"none\"))[0].innerText + \"#\" + \n\
document.getElementById(\"wob_tci\").alt + \"#\" + \n\
document.getElementById(\"wob_loc\").innerText + \"#\" + \n\
ep_weather_toHexString(result)\n\
);\n\
//console.log(res);\n\
document.body.style.backgroundColor='transparent';\n\
document.getElementById(\"frame\").contentWindow.document.body.style.backgroundColor='transparent';\n\
document.body.style.backgroundColor='transparent';\n\
return res;\n\
}\n\
var ep_result;\n\
let unit = Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t')[0].innerText;\n\
let unit = Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t')[0].innerText;\n\
let p = '%c';\n\
if (!unit.includes(p)) {\n\
Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('a')).filter(e => e.className == 'wob_t').filter(e => e.innerText.includes(p))[0].click();\n\
Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('a')).filter(e => e.className == 'wob_t').filter(e => e.innerText.includes(p))[0].click();\n\
unit = 'x';\n\
}\n\
createImageBitmap(\n\
document.getElementById(\"frame\").contentWindow.document.getElementById('wob_tci'), \n\
document.getElementById('wob_tci'), \n\
{ resizeWidth: %d, resizeHeight: %d, resizeQuality: 'high' }\n\
)\n\
.then(imageBitmap => \n\
@ -85,11 +97,13 @@ ep_weather_part1();\n\
LPCWSTR ep_weather_provider_google_script2 = L"\
function ep_weather_part2() {\n\
let h = document.getElementById(\"frame\").contentWindow.document.getElementsByClassName(\"ULSxyf\")[0].offsetHeight;\n\
document.getElementsByClassName(\"google-weather-place\")[0].style.height = h + 'px';\n\
document.getElementsByClassName(\"google-weather-crop\")[0].style.height = h + 'px';\n\
document.getElementById(\"frame\").contentWindow.document.getElementsByClassName(\"KFFQ0c\")[0].style.display = 'none';\n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"search\").scrollIntoView(true);\n\
let h = document.getElementsByClassName(\"ULSxyf\")[0].offsetHeight;\n\
////document.getElementsByClassName(\"google-weather-place\")[0].style.height = h + 'px';\n\
////document.getElementsByClassName(\"google-weather-crop\")[0].style.height = h + 'px';\n\
//if (1) for (let j = 0; j < document.styleSheets.length; j++) changeCSSStyle(j, '.wob_ds', 'background-color', '#303134');\n\
document.getElementsByClassName(\"KFFQ0c\")[0].style.display = 'none';\n\
if (document.getElementsByClassName(\"QS5gu sy4vM\").length > 1) { document.getElementsByClassName(\"QS5gu sy4vM\")[1].click(); return \"run_part_1\"; }\n\
document.getElementById(\"search\").scrollIntoView(true);\n\
return ep_result;\n\
}\n\
ep_weather_part2();\n\

View File

@ -2,6 +2,26 @@
#define _H_EP_WEATHER_UTILITY_H_
#include <Windows.h>
#include <stdint.h>
#ifndef NTDDI_WIN10_CO
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif
extern void(*RefreshImmersiveColorPolicyState)();
extern void(*SetPreferredAppMode)(INT64 bAllowDark);
extern void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);
extern BOOL(*ShouldAppsUseDarkMode)();
extern BOOL(*ShouldSystemUseDarkMode)();
inline BOOL IsColorSchemeChangeMessage(LPARAM lParam)
{
BOOL is = FALSE;
if (lParam && CompareStringOrdinal(lParam, -1, L"ImmersiveColorSet", -1, TRUE) == CSTR_EQUAL)
{
is = TRUE;
}
return is;
}
inline BOOL IsHighContrast()
{
HIGHCONTRASTW highContrast;

View File

@ -11,7 +11,7 @@ import "unknwn.idl";
{
HRESULT About([in] HWND hWnd);
HRESULT Initialize([in] WCHAR wszName[260], [in] BOOL bAllocConsole, [in] LONG64 dwProvider, [in] LONG64 cbx, [in] LONG64 cby, [in] LONG64 dwTemperatureUnit, [in] LONG64 dwUpdateSchedule, [in] RECT rc, [out] HWND* hWnd);
HRESULT Initialize([in] WCHAR wszName[260], [in] BOOL bAllocConsole, [in] LONG64 dwProvider, [in] LONG64 cbx, [in] LONG64 cby, [in] LONG64 dwTemperatureUnit, [in] LONG64 dwUpdateSchedule, [in] RECT rc, [in] LONG64 dwDarkMode, [in] LONG64 dwGeolocationMode, [out] HWND* hWnd);
HRESULT Show();
@ -58,4 +58,8 @@ import "unknwn.idl";
HRESULT SetIconSize([in] LONG64 cbx, [in] LONG64 cby);
HRESULT GetIconSize([out] LONG64* cbx, [out] LONG64* cby);
HRESULT SetDarkMode([in] LONG64 dwDarkMode, [in] LONG64 bRefresh);
HRESULT SetGeolocationMode([in] LONG64 dwGeolocationMode);
};

View File

@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 469
#define VER_BUILD_HI 42
#define VER_BUILD_LO 3
#define VER_BUILD_LO 4
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.469.42.3"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.469.42.3"
#define VER_FILE_STRING VALUE "FileVersion", "22000.469.42.4"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.469.42.4"