Hi,
I want to capture system theme change event in my WinUI3 app. I'm trying like below code snippet, but not receiving WM_SETTINGCHANGE message there.
void
TWWinUI3App::OnLaunched(LaunchActivatedEventArgs const&) {
// ...
Window window = Window();
window.Title(L"TW Window");
HWND hwnd;
int rc;
rc = window.try_as<IWindowNative>()->get_WindowHandle(&hwnd);
rc = SetWindowSubclass(hwnd, SUBCLASSPROC(TWWinUI3App::WindowSubClassHandler), 0, 0);
// ...
}
LRESULT CALLBACK
TWWinUI3App::WindowSubClassHandler (HWND pHwnd, UINT pMessageCode, WPARAM pWParam, LPARAM pLParam, [[maybe_unused]] UINT_PTR pIdSubclass, [[maybe_unused]] DWORD_PTR pRefData)
{
switch (pMessageCode) {
case WM_SETTINGCHANGE: {
// SETTINGS_CHANGED
break;
}
default:
return DefSubclassProc(pHwnd, pMessageCode, pWParam, pLParam);
}
}
Correct me if I'm missing anything.
Thanks.