Windows – Changing drag & drop behaviour in Windows 7’s explorer for touch screen use

drag and droptouchscreenwindows 7

I have a new touch screen, and am playing around with its functionality. The most productive use for me is organizing files (literally) by hand. It's fun working through a list of files, dragging and dropping them to the right locations using your index finger. It feels better on the wrist than mouse-clicking, too.

The only problem is that when I drag & drop files across drives in Windows 7, the default behaviour is to copy the file instead of moving it. I know I can influence this using right click, but that is of course no option in my situation.

How can I change the default drag & drop behaviour in Windows 7's explorer?

Starting a bounty to see whether there is anything new.

Best Answer

  • This is possible. Let's ask ourselves two questions:

    • What hapens when we drag and drop a file?

      • An API function is called to start dragging the file.
      • A window is shown while you drag.
      • An API function is called when you drop the file.
      • The operation is performed.
         
    • How can we modify the drag-drop behavior?

      • We could hook the API function(s) and adjust the parameters/code to move instead of copy.
      • But, there is an easier way: We could use a hotkey modifier while dragging...

    So, by some simple scripting, we can hold the SHIFT key when you drop the file based on the window!

    After some research to figure out the name of the window (hook Window Title functions with API Monitor) we can now create an AutoHotkey script that will hold the SHIFT key until after you drop the file.

    LButton Down:: 
       Send, {LButton Down}  
       IfWinExist, ahk_class SysDragImage 
       {
            Send, {LShift Down}
       } 
       return 
    
    LButton Up::
        IfWinExist, ahk_class SysDragImage 
       {
            Send, {LButton Up}
            Sleep, 500 ; Feel free to adjust higher/lower to improve the behavior.
            Send, {LShift Up}
       } 
        Send, {LButton Up}
        return
    

    Haven't really tried the above code, but I think I believe it should work.

    Possible improvements:

    • Use AutoIt instead with a function like WinWait, so you don't have to react on the mouse.
    • Go for the hard stuff and write and hook the API functions, although you might need to hack a bit.

    I hope the above script works or that I gave you a good start. :-)