https://git.reactos.org/?p=reactos.git;a=commitdiff;h=087979eeb9186c8ae6aff76a38ef804eef7e8f50

commit 087979eeb9186c8ae6aff76a38ef804eef7e8f50
Author:     Whindmar Saksit <whinds...@proton.me>
AuthorDate: Mon Jan 13 13:21:12 2025 +0100
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Jan 13 13:21:12 2025 +0100

    [REGEDIT] Block tree label edit if the delete accelerator has been pressed 
(#7610)
---
 base/applications/regedit/treeview.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/base/applications/regedit/treeview.c 
b/base/applications/regedit/treeview.c
index dcb6ce350df..ca784f12e6c 100644
--- a/base/applications/regedit/treeview.c
+++ b/base/applications/regedit/treeview.c
@@ -668,6 +668,8 @@ BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM 
lParam, BOOL *Result)
         case TVN_BEGINLABELEDIT:
         {
             LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
+            HWND hWndFocus = GetFocus();
+
             /* cancel label edit for rootkeys */
             if (!TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem) 
||
                 !TreeView_GetParent(g_pChildWnd->hTreeWnd, 
TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem)))
@@ -678,6 +680,12 @@ BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM 
lParam, BOOL *Result)
             {
                 *Result = FALSE;
             }
+
+            /* cancel label edit if VK_DELETE accelerator opened a MessageBox 
*/
+            if (hWndFocus != g_pChildWnd->hTreeWnd && hWndFocus != 
TreeView_GetEditControl(g_pChildWnd->hTreeWnd))
+            {
+                *Result = TRUE;
+            }
             return TRUE;
         }
         case TVN_ENDLABELEDIT:

Reply via email to