3

The Windows Operating System has a very convenient drag and drop feature, which is very common knowledge to any user, but there's a technical view of it; some developer at some point in time added that feature to the OS. And its a great feature, it enhances the user experience quite a bit. Here's a picture for reference.

What I'm wondering is how does this feature work "behind the scenes?" I've found articles online explaining its behavior, for instance dragging a file from a network location will copy the file instead of move it, but that's not the type of explanation I'm looking for.

I'm looking for a more technical explanation about what it does. If I were to right click on a file, select "Cut" and then right click in a different directory and select "Paste" - to me, the user, that seems like the same general procedure as a drag and drop, I'm just not using the convenience feature. But from a technical standpoint is that the correct operation that's occurring? When I drag a file and Windows moves it from one directory to another, does it indeed perform a cut action on the source file, copy the file to the destination, and perform a delete action on the source file? Perhaps there is a validation step at some point in the process as well. I would assume that either the entire file is written into memory before the move or pieces of the file are written into memory as it moves it.

I'd love to know any and all technical and "behind the scenes" information that anyone has to offer about the drag and drop functionality (down to a dll function, if anyone knows it) and how it compares to other methods of moving a file like cut and paste.

0

FYI: My information may be dated because I'm dated.

Behind the scenes drag&drop uses COM objects. COM is a whole world of pain, but basically it allows different applications to talk to each other. When you drag & drop, you create a message that is sent to the target application.

There is more than just one solution to this (like file objects vs non-file objects). I assume Windows Store Apps have a modern non-COM implementation.

I would suggest you first browse over what COM is:

https://en.wikipedia.org/wiki/Component_Object_Model

And then satisfy your curiosity by looking over this:

https://www.codeproject.com/Articles/840/How-to-Implement-Drag-and-Drop-Between-Your-Progra

  • I appreciate your "dated" answer very much. I've known about COM for a while but I've never had a reason to really learn much about it. One more piece of information that I think is relevant is how a drag and drop is pretty instant while a cut and paste is not. I believe that a drag and drop doesn't require very much disk usage at all, it essentially updates the table of contents but the location of the file in the disk stays the same, while a cut and paste requires actual deletion and writing of the file. If that's incorrect or inaccurate please feel free to inform me. – Tyler N Apr 25 at 12:44
  • I haven't noticed (but also wasn't looking). If you only notice the difference with a large number of files, it could be that the CUT requires enumerating the files ahead of time (Notice how they grey out?). Where as the Drag-Drop may do the enumerating while the copy is occurring. – Robert Paulsen Apr 25 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.