From daea18646f4de86d7103f2cbbe7d0babf2be3a00 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 Sep 2008 16:36:28 -0700 Subject: [PATCH] regedit: Pass VK_DELETE messages to edit controls. --- programs/regedit/framewnd.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index 4d8056e..93bd96b 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -643,6 +643,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) DWORD valueType; int curIndex; BOOL firstItem = TRUE; + HWND hwndDelete; if (LOWORD(wParam) >= ID_FAVORITE_FIRST && LOWORD(wParam) <= ID_FAVORITE_LAST) { HKEY hKey; @@ -681,7 +682,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; } case ID_EDIT_DELETE: - if (GetFocus() == g_pChildWnd->hTreeWnd) { + hwndDelete = GetFocus(); + if (hwndDelete == g_pChildWnd->hTreeWnd) { WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); if (keyPath == 0 || *keyPath == 0) { MessageBeep(MB_ICONHAND); @@ -689,7 +691,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) DeleteNode(g_pChildWnd->hTreeWnd, 0); } HeapFree(GetProcessHeap(), 0, keyPath); - } else if (GetFocus() == g_pChildWnd->hListWnd) { + } else if (hwndDelete == g_pChildWnd->hListWnd) { WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); curIndex = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED); while(curIndex != -1) { @@ -713,7 +715,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); HeapFree(GetProcessHeap(), 0, keyPath); - } + } else { + static const WCHAR editW[] = { 'E','d','i','t',0 }; + const int len = strlenW(editW) + 1; + WCHAR class_name[len]; + if (GetClassNameW(hwndDelete, class_name, len) > 0) + if (strncmpW(class_name, editW, len - 1) == 0) + SendMessage(hwndDelete, WM_KEYDOWN, VK_DELETE, 0); + } break; case ID_EDIT_MODIFY: { -- 1.5.4.5