https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1cf564c25f532c32f9faeā¦
commit 1cf564c25f532c32f9fae891f17a70e62d5c1c14
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Feb 12 12:14:15 2020 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Wed Feb 12 12:14:15 2020 +0900
[SHELL32] Use background context if no item selected on File menu
CORE-9467
---
dll/win32/shell32/CDefView.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index 2bbf523fbe7..f2cfcead5f7 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -1207,8 +1207,11 @@ HRESULT CDefView::FillFileMenu()
DeleteMenu(hFileMenu, i, MF_BYPOSITION);
}
+ m_cidl = m_ListView.GetSelectedCount();
+
/* Store the context menu in m_pCM and keep it in order to invoke the selected
command later on */
- HRESULT hr = GetItemObject(SVGIO_SELECTION, IID_PPV_ARG(IContextMenu, &m_pCM));
+ HRESULT hr = GetItemObject((m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND),
+ IID_PPV_ARG(IContextMenu, &m_pCM));
if (FAILED_UNEXPECTEDLY(hr))
return hr;