From 908d7f31672254f1f761a763f61443e1c657403b Mon Sep 17 00:00:00 2001 From: RadAd Date: Wed, 7 Jul 2021 11:11:06 +1000 Subject: Fix for dpi change --- RadTerminal.cpp | 4 ---- RadTerminalFrame.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/RadTerminal.cpp b/RadTerminal.cpp index fe35541..0ab4de4 100644 --- a/RadTerminal.cpp +++ b/RadTerminal.cpp @@ -1328,10 +1328,6 @@ LRESULT CALLBACK RadTerminalWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR //return MyDefWindowProc(hWnd, uMsg, wParam, lParam); switch (uMsg) { - case WM_NCCREATE: - EnableNonClientDpiScaling(hWnd); - return MyDefWindowProc(hWnd, uMsg, wParam, lParam); - case WM_DPICHANGED: { RadTerminalData* const data = (RadTerminalData*) GetWindowLongPtr(hWnd, GWLP_USERDATA); diff --git a/RadTerminalFrame.cpp b/RadTerminalFrame.cpp index 9d6ac01..b6c8cd5 100644 --- a/RadTerminalFrame.cpp +++ b/RadTerminalFrame.cpp @@ -44,6 +44,18 @@ HWND CreateRadTerminalFrame(HINSTANCE hInstance) inline LRESULT MyDefFrameWindowProc(_In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam) { + if (Msg == WM_DPICHANGED) + { + RECT* const prcNewWindow = (RECT*) lParam; + SetWindowPos(hWnd, + NULL, + prcNewWindow->left, + prcNewWindow->top, + prcNewWindow->right - prcNewWindow->left, + prcNewWindow->bottom - prcNewWindow->top, + SWP_NOZORDER | SWP_NOACTIVATE); + } + return DefFrameProc(hWnd, GetMDIClient(hWnd), Msg, wParam, lParam); } -- cgit v1.2.3