shell32: Bind to correct drop target after drag scrolling

Michael Jung mjung at iss.tu-darmstadt.de
Mon Dec 5 11:01:57 CST 2005


Hi Alexandre, 

seems like you rejected this patch. Is it too hack'ish? At a first glance it 
seems like it would be enough to figure out the IDropTarget belonging to the 
hwnd and call a DragOver on this interface. The problem is that the drop 
source (or the DoDragDrop function) might have to change the cursor. 

Could you please give me a tip on how to do this the right way?

Index: dlls/shell32/shlview.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlview.c,v
retrieving revision 1.123
diff -u -p -r1.123 shlview.c
--- dlls/shell32/shlview.c	2 Dec 2005 13:14:58 -0000	1.123
+++ dlls/shell32/shlview.c	2 Dec 2005 16:44:38 -0000
@@ -2190,6 +2190,8 @@ static ULONG WINAPI ISVDropTarget_Releas
 #define IDT_RIGHT 0x8u
 
 VOID CALLBACK scroll_timer_proc(HWND hwnd, UINT uMsg, UINT_PTR idTimer, DWORD 
dwTimer) {
+    INPUT input;
+
     switch (idTimer) {
         case IDT_UP:
             SendMessageW(hwnd, WM_VSCROLL, SB_LINEUP, 0);
@@ -2204,6 +2206,14 @@ VOID CALLBACK scroll_timer_proc(HWND hwn
             SendMessageW(hwnd, WM_HSCROLL, SB_LINEDOWN, 0);
             break;
     }
+
+    /* The cursor might now hover over a different item in the listview than
+     * prior to the scrolling. Send a dummy mouse event (with a (x=0, y=0)
+     * relative movement) to initiate the apropriate Drag & Drop calls. */
+    ZeroMemory(&input, sizeof(input));
+    input.type = INPUT_MOUSE;
+    input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
+    SendInput(1, &input, sizeof(input));
 }
 
 /******************************************************************************

Bye,
-- 
Michael Jung
mjung at iss.tu-darmstadt.de



More information about the wine-devel mailing list