https://git.reactos.org/?p=reactos.git;a=commitdiff;h=468a5492a9849f38faeaa…
commit 468a5492a9849f38faeaa3f2c4973e9b12849af5
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Dec 10 16:55:34 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Dec 10 16:55:34 2023 +0900
[SHIMGVW] Support Drag & Drop
- Use DragAcceptFiles and WM_DROPFILES.
CORE-19358
---
dll/win32/shimgvw/shimgvw.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c
index 00b3a90ac3c..32f944c55a5 100644
--- a/dll/win32/shimgvw/shimgvw.c
+++ b/dll/win32/shimgvw/shimgvw.c
@@ -729,6 +729,8 @@ ZoomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL
Preview_OnCreate(HWND hwnd, LPCREATESTRUCT pCS)
{
+ DragAcceptFiles(hwnd, TRUE);
+
g_hDispWnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_STATIC, L"",
WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, hwnd, NULL, g_hInstance, NULL);
@@ -980,6 +982,20 @@ Preview_OnDestroy(HWND hwnd)
PostQuitMessage(0);
}
+static VOID
+Preview_OnDropFiles(HWND hwnd, HDROP hDrop)
+{
+ WCHAR szFile[MAX_PATH];
+
+ DragQueryFileW(hDrop, 0, szFile, _countof(szFile));
+
+ pFreeFileList(g_pCurrentFile);
+ g_pCurrentFile = pBuildFileList(szFile);
+ pLoadImageFromNode(g_pCurrentFile, hwnd);
+
+ DragFinish(hDrop);
+}
+
LRESULT CALLBACK
PreviewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -1023,6 +1039,11 @@ PreviewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Preview_OnSize(hwnd, (UINT)wParam, GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam));
break;
}
+ case WM_DROPFILES:
+ {
+ Preview_OnDropFiles(hwnd, (HDROP)wParam);
+ break;
+ }
case WM_DESTROY:
{
Preview_OnDestroy(hwnd);