From c092722a147940532b08f62403e182ef279f2c74 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 27 Oct 2021 15:30:02 -0500 Subject: Add CS_HREDRAW and CS_VREDRAW to fix painting issues when resizing. --- src/samples/thmviewer/display.cpp | 14 +++----------- src/samples/thmviewer/thmviewer.cpp | 9 ++------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'src/samples') diff --git a/src/samples/thmviewer/display.cpp b/src/samples/thmviewer/display.cpp index e64f79c6..9ef88018 100644 --- a/src/samples/thmviewer/display.cpp +++ b/src/samples/thmviewer/display.cpp @@ -78,11 +78,7 @@ static DWORD WINAPI DisplayThreadProc( HANDLE_THEME* pCurrentHandle = NULL; ATOM atomWc = 0; - WNDCLASSW wc = { }; // the following are constant for the display window class. - wc.lpfnWndProc = DisplayWndProc; - wc.hInstance = hInstance; - wc.lpszClassName = THMVWR_WINDOW_CLASS_DISPLAY; - + WNDCLASSW wc = { }; HWND hWnd = NULL; RECT rc = { }; int x = CW_USEDEFAULT; @@ -170,12 +166,8 @@ static DWORD WINAPI DisplayThreadProc( pCurrentHandle = reinterpret_cast(msg.lParam); if (pCurrentHandle) { - wc.hIcon = reinterpret_cast(pCurrentHandle->pTheme->hIcon); - wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); - if (0 < pCurrentHandle->pTheme->cFonts) - { - wc.hbrBackground = pCurrentHandle->pTheme->rgFonts[pCurrentHandle->pTheme->dwFontId].hBackground; - } + ThemeInitializeWindowClass(pCurrentHandle->pTheme, &wc, DisplayWndProc, hInstance, THMVWR_WINDOW_CLASS_DISPLAY); + atomWc = ::RegisterClassW(&wc); if (!atomWc) { diff --git a/src/samples/thmviewer/thmviewer.cpp b/src/samples/thmviewer/thmviewer.cpp index 1d941323..94b1ef55 100644 --- a/src/samples/thmviewer/thmviewer.cpp +++ b/src/samples/thmviewer/thmviewer.cpp @@ -312,13 +312,8 @@ static HRESULT CreateMainWindowClass( ATOM atom = 0; WNDCLASSW wc = { }; - wc.lpfnWndProc = MainWndProc; - wc.hInstance = hInstance; - wc.hIcon = reinterpret_cast(pTheme->hIcon); - wc.hCursor = ::LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); - wc.hbrBackground = pTheme->rgFonts[pTheme->dwFontId].hBackground; - wc.lpszMenuName = NULL; - wc.lpszClassName = THMVWR_WINDOW_CLASS_MAIN; + ThemeInitializeWindowClass(pTheme, &wc, MainWndProc, hInstance, THMVWR_WINDOW_CLASS_MAIN); + atom = ::RegisterClassW(&wc); if (!atom) { -- cgit v1.2.3-55-g6feb