Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Drag and Drop files ?

Posted on 2002-07-03
4
Medium Priority
?
440 Views
Last Modified: 2013-11-20
Hi Experts
I created a MFC app which deals with files and folders. I want to add drag and drop fecility
to this app. How can I achieve it. i.e when Files or folders are drag and drop to the CTreeCtrl of this app it will add such a node . plz help me.
0
Comment
Question by:anij
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:1cand01t
ID: 7128933
See following article in MSDN:

"Drag and Drop: Implementing a Drop Target"

also see the details of class "COleDropTarget".

goodluck.
0
 

Author Comment

by:anij
ID: 7130891
I don't have msdn
0
 

Expert Comment

by:1cand01t
ID: 7131040
To implement a drop target

"Add a member variable to each view in the application that you want to be a drop target. This member variable must be of type COleDropTarget or a class derived from it.


From your view class’s function that handles the WM_CREATE message (typically OnCreate), call the new member variable’s Register member function. Revoke will be called automatically for you when your view is destroyed.


Override the following functions. If you want the same behavior throughout your application, override these functions in your view class. If you want to modify behavior in isolated cases or want to enable dropping on non-CView windows, override these functions in your COleDropTarget-derived class.

OnDragEnter: Drop operations to occur in the window. Called when the cursor first enters the window.

OnDragLeave: Special behavior when the drag operation leaves the specified window.

OnDragOver: Drop operations to occur in the window. Called when the cursor is being dragged across the window.

OnDrop: Handling of data being dropped into the specified window."


In treeview u can use HitTest() function to check on which treeitem the file was dropped.
0
 
LVL 37

Accepted Solution

by:
zzynx earned 300 total points
ID: 7131139
First:
You don't need to have MSDN to be able to consult MSDN articles. There's the internet, you know? http://msdn.microsoft.com

Second:
This article may interest you: http://www.codeproject.com/useritems/rdragdropfiles.asp

Success.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

660 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