From c5b377b22fcea45454a921cc3c0e918c2ebce7c0 Mon Sep 17 00:00:00 2001 From: dreamforceinc Date: Mon, 18 Dec 2023 18:20:28 +0300 Subject: [PATCH] Added the 'Center' button and the ability to center the window from the 'Manual editing' dialog. --- wCenterWindow/resource.h | 41 ++++++++------------------------ wCenterWindow/wCenterWindow.cpp | 12 ++++++++-- wCenterWindow/wCenterWindow.rc | Bin 16138 -> 16286 bytes 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/wCenterWindow/resource.h b/wCenterWindow/resource.h index 766cf53..f6654ac 100644 --- a/wCenterWindow/resource.h +++ b/wCenterWindow/resource.h @@ -1,25 +1,3 @@ -// MIT License -// -// Copyright (c) 2023 W0LF aka 'dreamforce' -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by wCenterWindow.rc @@ -57,14 +35,15 @@ #define IDC_EDIT_TITLE 1004 #define IDC_EDIT_CLASS 1005 #define IDC_BUTTON_SET 1006 -#define IDC_BUTTON_CLOSE 1007 -#define IDC_ABOUTHELP 1008 -#define IDC_DONATIONLINK 1009 -#define IDC_DONATIONTEXT 1010 -#define IDC_ABOUT_PROGNAME 1011 -#define IDC_ABOUT_COPYRIGHT 1012 -#define IDC_ABOUT_BUILDTIME 1013 -#define IDC_ABOUTEDIT 1014 +#define IDC_BUTTON_CENTER 1007 +#define IDC_BUTTON_CLOSE 1008 +#define IDC_ABOUTHELP 1009 +#define IDC_DONATIONLINK 1010 +#define IDC_DONATIONTEXT 1011 +#define IDC_ABOUT_PROGNAME 1012 +#define IDC_ABOUT_COPYRIGHT 1013 +#define IDC_ABOUT_BUILDTIME 1014 +#define IDC_ABOUTEDIT 1015 #define IDC_STATIC -1 // Next default values for new objects @@ -74,7 +53,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 130 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1015 +#define _APS_NEXT_CONTROL_VALUE 1016 #define _APS_NEXT_SYMED_VALUE 126 #endif #endif diff --git a/wCenterWindow/wCenterWindow.cpp b/wCenterWindow/wCenterWindow.cpp index 669fc6c..76d179d 100644 --- a/wCenterWindow/wCenterWindow.cpp +++ b/wCenterWindow/wCenterWindow.cpp @@ -23,8 +23,6 @@ // wCenterWindow // wCenterWindow.cpp -// TODO: Add license info into About dialog. -// TODO: Add 'Center' button into Manual Editing dialog. // TODO: Fix tray icon that disappears after explorer reboot. // TODO: Split main cpp-file to separate files. // TODO: Change keyboard low-level hook to RegisterHotKey function. @@ -528,6 +526,16 @@ INT_PTR CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam) return static_cast(TRUE); break; } + case IDC_BUTTON_CENTER: + { + logger.Out(L"%s(%d): Pressed the 'Center' button", TEXT(__FUNCTION__), __LINE__); + + bKPressed = TRUE; + if (IsWindowApprooved(hFgWnd)) MoveWindowToMonitorCenter(hFgWnd, bWorkArea, FALSE); + else hFgWnd = NULL; + return static_cast(TRUE); + break; + } case IDCANCEL: case IDC_BUTTON_CLOSE: { diff --git a/wCenterWindow/wCenterWindow.rc b/wCenterWindow/wCenterWindow.rc index 5f61dedacdaa59813cee7d13b83509af2c2e1e26..e7fc6afb208e89041971e8bbe256e74708dfbabe 100644 GIT binary patch delta 83 zcmeCGn^(WVkA3nHfs)P3*q^XZR^V4Mb!JFq$YUr0l0^(k3_1*+3@!}L4Dk$34517m fK$UgzvSj7{tkTryi*iD delta 17 YcmbPN-&ME4k9~6%yA8)?Ie`X!06=&KBLDyZ