From 559dfea041833efed0a53d2a630bce38720c4017 Mon Sep 17 00:00:00 2001 From: andreja6 Date: Tue, 5 Nov 2019 23:10:32 -0800 Subject: [PATCH] Works very, very well now --- Application.cpp | 9 ++++++--- main.cpp | 5 ++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Application.cpp b/Application.cpp index 338558c..eff3fbe 100644 --- a/Application.cpp +++ b/Application.cpp @@ -58,10 +58,13 @@ void Application::setFocus(bool focus) { if(focus) { - MessageBox(NULL, "NO", "NO", MB_OK); - SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + ShowWindow(_propWindow->_hwndProp, SW_SHOW); + SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + else + { + SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } - else SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } Application::Application(HWND parentWindow) { //: GApp(settings,window) { diff --git a/main.cpp b/main.cpp index 962cf28..670a5e7 100644 --- a/main.cpp +++ b/main.cpp @@ -74,10 +74,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_SIZE: app->resizeWithParent(hwnd); break; - case WM_ACTIVATEAPP: - if(wParam == FALSE) app->setFocus(false); + case WM_ACTIVATE: + if(wParam > WA_INACTIVE) app->setFocus(false); else app->setFocus(true); - break; default: { return DefWindowProc(hwnd, msg, wParam, lParam);