Start file drag drop from AutoHotkey GUI to any other window and use/mimic File Explorer drag drop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
neogna2
Posts: 586
Joined: 15 Sep 2016, 15:44

Start file drag drop from AutoHotkey GUI to any other window and use/mimic File Explorer drag drop

Post by neogna2 » 09 Nov 2020, 15:32

I want to drag and drop files from an AutoHotkey GUI ListView to any other application window and as far as possible use or mimic the visuals and functionality of dragging files from File Explorer in Windows 10.

Functionality
- Press Shift while dragging and the action changes from "Copy to" to "Move to"
- Press Alt while dragging and the action changes from "Copy to" to "Create link in"
- Show a "Replace or Skip Files" popup window if a file with the same name already exist in the destination folder when we drop.

Visuals
- A large semitransparent rectangle is shown near the mouse during drag. The rectangle shows the dragged file's icon or a thumbnail, if the file is an image.
- The mouse cursor and a tooltip near it changes depending on what window the mouse is over.

It seems difficult to mimic all of that completely using AutoHotkey GUIs and what not, but maybe some of the above can be had? Perhaps there is even a method to make AutoHotkey start a "real" File Explorer drag drop action, with all of the above, but without opening a (visible) File Explorer window?

I have read through a bunch of drag drop related posts in the forums.

Functions DropFiles() and HDrop() from 2014 by RHCP and others https://autohotkey.com/board/topic/41467-make-ahk-drop-files-into-other-applications/page-2#entry638376
Both use the PostMessage WM_DROPFILES method.
I can drop a file on Notepad and various other windows with those functions, but nothing happens when I try to drop on a File Explorer window. The functions have no drag drop visuals.

An OleDropTargetInterface approach from 2018 by jeeswg.
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=56720
jeeswg writes that the method depends on injecting a AutoHotkey dll into the program we are dragging to, but I did not get it to work.

In this 2009 thread Sean talked to SKAN about using SHDoDragDrop
https://autohotkey.com/board/topic/41371-drop-files-simulation/?p=258495
but the example code is incomplete and the thread comes to an end
Microsoft docs page on SHDoDragDrop https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shdodragdrop
In 2011 someone else asked about SHDoDragDrop but got no replies
https://autohotkey.com/board/topic/64149-problems-with-automating-shdodragdrop/
william_ahk
Posts: 482
Joined: 03 Dec 2018, 20:02

Re: Start file drag drop from AutoHotkey GUI to any other window and use/mimic File Explorer drag drop

Post by william_ahk » 06 Dec 2023, 06:47

Damn, I'm looking for this too. Is it not possible? Have you found a workaround perhaps? I just need to be able to drag files from whatever type of control in the Gui.
Post Reply

Return to “Ask for Help (v1)”