From 860262952dae38ff2346584eb84246c9caf40a2b Mon Sep 17 00:00:00 2001 From: Mohammad Amin Mollazadeh Date: Thu, 24 Apr 2025 00:40:08 +0330 Subject: [PATCH] [SHELL32] Fix Deselect highlighted item in shell menus on close (#7904) CORE-18855 Add a call to _ChangeHotItem(NULL, -1, 0) in CMenuBand::OnSelect(MPOS_CANCELLEVEL) which causes to deselect currently selected item the moment the menu bands (including start menu) are closing. Start Menu is not destroyed when it's closed so its allocated resources can be re-used next time user wants to open it, so to keep this behavior and still not having an item selected every time you open the start menu, you have to deselect the currently selected item. --- dll/win32/shell32/shellmenu/CMenuBand.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dll/win32/shell32/shellmenu/CMenuBand.cpp b/dll/win32/shell32/shellmenu/CMenuBand.cpp index 36c58121984..c46a7326345 100644 --- a/dll/win32/shell32/shellmenu/CMenuBand.cpp +++ b/dll/win32/shell32/shellmenu/CMenuBand.cpp @@ -588,6 +588,8 @@ HRESULT STDMETHODCALLTYPE CMenuBand::OnSelect(DWORD dwSelectType) case MPOS_CANCELLEVEL: if (m_subMenuChild) m_subMenuChild->OnSelect(dwSelectType); + // Deselect the currently selected item + _ChangeHotItem(NULL, -1, 0); break; } return S_FALSE;