[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Drag&Drop File Copy

Posted on 2005-04-14
Medium Priority
Last Modified: 2010-04-16

I want to copy or move files with dragging list entry items or icons to Windows Explorer window. Most of the tutorials and code examples show how to accept dropped items, not how to drop them to the other application windows.

I have found several C++ & Win32 api examples (for an example visit http://www.codeproject.com/shell/explorerdragdrop.asp) but I couldn't succeeded to make a working translation yet.

Can you help me with this?

Thanking in advance...
Question by:smalkim
1 Comment

Accepted Solution

Ceiled earned 900 total points
ID: 13782932
Dragging files onto Explorer is indeed quite complicated, especially in .NET, where objects are somewhat more complicated than simply a structured memory layout. Fortunately, System.Windows.Forms.DataObject has functionality built in especially for this:

string[] fileNames = GetFileNamesToDrag();
DataObject obj = new DataObject(DataFormats.FileDrop, strings);
DoDragDrop(obj, DragDropEffects.Copy);

Obviously, you can use DragDropEffects.Move to move instead of copy. If you specify both (DragDropEffects.Copy | DragDropEffects.Move), then Explorer will automatically determine whether it should move or copy it based on the modifier keys you're holding down (ctrl to copy, shift to move). Hope this helps.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question