From 9034d33599132a705f5852a4258affe97f12e5cd Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 6 Jul 2020 19:56:06 +1000 Subject: Update to latest thmutil. --- src/thmviewer/display.cpp | 13 +++++++------ src/thmviewer/packages.config | 2 +- src/thmviewer/thmviewer.cpp | 14 +++++++------- src/thmviewer/thmviewer.manifest | 8 ++++++++ src/thmviewer/thmviewer.vcxproj | 4 ++-- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/thmviewer/display.cpp b/src/thmviewer/display.cpp index cfd1c6b7..52fa3cf8 100644 --- a/src/thmviewer/display.cpp +++ b/src/thmviewer/display.cpp @@ -110,8 +110,8 @@ static DWORD WINAPI DisplayThreadProc( y = rc.bottom + 20; } - hWnd = ::CreateWindowExW(0, wc.lpszClassName, pTheme->sczCaption, pTheme->dwStyle, x, y, pTheme->nWidth, pTheme->nHeight, hwndParent, NULL, hInstance, pCurrentHandle); - ExitOnNullWithLastError(hWnd, hr, "Failed to create display window."); + hr = ThemeCreateParentWindow(pTheme, 0, wc.lpszClassName, pTheme->sczCaption, pTheme->dwStyle, x, y, hwndParent, hInstance, pCurrentHandle, THEME_WINDOW_INITIAL_POSITION_DEFAULT, &hWnd); + ExitOnFailure(hr, "Failed to create display window."); fCreateIfNecessary = FALSE; } @@ -263,9 +263,10 @@ static LRESULT CALLBACK DisplayWndProc( { case WM_NCCREATE: { - LPCREATESTRUCT lpcs = reinterpret_cast(lParam); - IncrementHandleTheme(reinterpret_cast(lpcs->lpCreateParams)); - ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, reinterpret_cast(lpcs->lpCreateParams)); + LPCREATESTRUCT lpcs = reinterpret_cast(lParam); + pHandleTheme = reinterpret_cast(lpcs->lpCreateParams); + IncrementHandleTheme(pHandleTheme); + ::SetWindowLongPtrW(hWnd, GWLP_USERDATA, reinterpret_cast(pHandleTheme)); } break; @@ -328,7 +329,7 @@ static BOOL DisplayOnCreate( { HRESULT hr = S_OK; - hr = ThemeLoadControls(pTheme, hWnd, NULL, 0); + hr = ThemeLoadControls(pTheme, NULL, 0); ExitOnFailure(hr, "Failed to load theme controls"); // Pre-populate some control types with data. diff --git a/src/thmviewer/packages.config b/src/thmviewer/packages.config index f3abcd35..49f06de8 100644 --- a/src/thmviewer/packages.config +++ b/src/thmviewer/packages.config @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/src/thmviewer/thmviewer.cpp b/src/thmviewer/thmviewer.cpp index adad3f50..f83182d3 100644 --- a/src/thmviewer/thmviewer.cpp +++ b/src/thmviewer/thmviewer.cpp @@ -100,8 +100,8 @@ int WINAPI wWinMain( hr = CreateMainWindowClass(hInstance, vpTheme, &atom); ExitOnFailure(hr, "Failed to create main window."); - hWnd = ::CreateWindowExW(0, reinterpret_cast(atom), vpTheme->sczCaption, vpTheme->dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, vpTheme->nWidth, vpTheme->nHeight, HWND_DESKTOP, NULL, hInstance, NULL); - ExitOnNullWithLastError(hWnd, hr, "Failed to create window."); + hr = ThemeCreateParentWindow(vpTheme, 0, reinterpret_cast(atom), vpTheme->sczCaption, vpTheme->dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, hInstance, NULL, THEME_WINDOW_INITIAL_POSITION_DEFAULT, &hWnd); + ExitOnFailure(hr, "Failed to create window."); if (!sczThemeFile) { @@ -353,11 +353,11 @@ static LRESULT CALLBACK MainWndProc( case WM_CREATE: { - HRESULT hr = ThemeLoadControls(vpTheme, hWnd, vrgInitControls, countof(vrgInitControls)); - if (FAILED(hr)) - { - return -1; - } + HRESULT hr = ThemeLoadControls(vpTheme, vrgInitControls, countof(vrgInitControls)); + if (FAILED(hr)) + { + return -1; + } } break; diff --git a/src/thmviewer/thmviewer.manifest b/src/thmviewer/thmviewer.manifest index 6bd63a5e..4663b61c 100644 --- a/src/thmviewer/thmviewer.manifest +++ b/src/thmviewer/thmviewer.manifest @@ -7,5 +7,13 @@ WiX Toolset Theme Viewer + + + + true/pm + + PerMonitorV2, PerMonitor, System + + diff --git a/src/thmviewer/thmviewer.vcxproj b/src/thmviewer/thmviewer.vcxproj index fb9908e6..a56a0bd4 100644 --- a/src/thmviewer/thmviewer.vcxproj +++ b/src/thmviewer/thmviewer.vcxproj @@ -5,7 +5,7 @@ - + @@ -83,6 +83,6 @@ - + \ No newline at end of file -- cgit v1.2.3-55-g6feb