https://git.reactos.org/?p=reactos.git;a=commitdiff;h=771457f37f0673c8fa1f6…
commit 771457f37f0673c8fa1f6e11268b7b5885780813
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Apr 26 22:06:19 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Apr 26 22:06:19 2020 +0900
[SHELL32] Implement VK_DELETE on SHBrowseForFolder (#2661)
Enable Del/Delete key to delete the selected folder in "Browse for Folder"
dialog.
You can use
https://jira.reactos.org/secure/attachment/40118/getfolder.zip as a test
program.
CORE-7592
---
dll/win32/shell32/wine/brsfolder.c | 43 +++++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/dll/win32/shell32/wine/brsfolder.c b/dll/win32/shell32/wine/brsfolder.c
index be45792654f..cfe982d53d9 100644
--- a/dll/win32/shell32/wine/brsfolder.c
+++ b/dll/win32/shell32/wine/brsfolder.c
@@ -625,6 +625,40 @@ static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
return S_OK;
}
+#ifdef __REACTOS__
+static void
+BrsFolder_Delete(browse_info *info, HTREEITEM selected_item)
+{
+ TV_ITEMW item;
+ TV_ITEMDATA *item_data;
+ SHFILEOPSTRUCTW fileop = { info->hwndTreeView };
+ WCHAR szzFrom[MAX_PATH + 1];
+
+ /* get item_data */
+ item.mask = TVIF_HANDLE | TVIF_PARAM;
+ item.hItem = selected_item;
+ if (!SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item))
+ {
+ ERR("TVM_GETITEMW failed\n");
+ return;
+ }
+ item_data = (TV_ITEMDATA *)item.lParam;
+
+ /* get the path */
+ if (!SHGetPathFromIDListW(item_data->lpifq, szzFrom))
+ {
+ ERR("SHGetPathFromIDListW failed\n");
+ return;
+ }
+ szzFrom[lstrlenW(szzFrom) + 1] = 0; /* double NULL-terminated */
+ fileop.pFrom = szzFrom;
+
+ /* delete folder */
+ fileop.fFlags = FOF_ALLOWUNDO;
+ fileop.wFunc = FO_DELETE;
+ SHFileOperationW(&fileop);
+}
+#endif
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
{
HTREEITEM selected_item;
@@ -643,14 +677,7 @@ static LRESULT BrsFolder_Treeview_Keydown(browse_info *info,
LPNMTVKEYDOWN keydo
case VK_DELETE:
{
#ifdef __REACTOS__
- /*********************************************************
- FIXME: Add a proper alternative implementation for ReactOS
-
- NOTES: Wine makes use of the ISFHelper interface, which we
- don't have in ReactOS.
- It's defined in dlls/shell32/shellfolder.h and implemented
- in dlls/shell32/shfldr_fs.c on Wine's side.
- *********************************************************/
+ BrsFolder_Delete(info, selected_item);
#else
const ITEMIDLIST *item_id;
ISFHelper *psfhlp;