Solved

drag & drop

Posted on 1998-11-14
6
203 Views
Last Modified: 2013-11-20
I have made a dialog box in vc++ and set the "accept files" feature on it.  If I drag a file into the box, it takes it, but I cannot figure out how to get my program to respond to the drop.  All I want is for my program to return the name of the file the user has dragged into it.  Can someone please show me how to do this?
0
Comment
Question by:Mouser
  • 4
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
motigust earned 90 total points
Comment Utility
All you have to do now is:
1. Override the OnDropFiles function of that dialog
2. Use the following to get the file anmes:

      Num = DragQueryFile(hDropInfo, 0xFFFFFFFF, fName, 500);
      
      for (UINT i=0;i<Num;i++) {
        DragQueryFile(hDropInfo, i, fName, 500);
      }
// fname holds the file names


Goodluck!


0
 

Author Comment

by:Mouser
Comment Utility
Where do I need to place the function in my program?  I placed it in several places, and it keeps causing a fatal error.
0
 
LVL 1

Expert Comment

by:motigust
Comment Utility
Use the wizard to override the WM_DROPFILE message,
then you will have a function that gets DropInfo as parametes.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:Mouser
Comment Utility
I'm sorry, but I'm still confused on what you mean.  When I go to the ClassWizard in my project, it doesn't have a WM_DROPFILE message to edit.  The only member function that comes close to what your talking about is some function called an OnQueryDragIcon(), is this it?
However, if I make a call to OnDropFiles in my application, my program reconizes this function.  So how do I get to it within the wizard to place my code instead?
Thank you for helping me motigust,  I really appreciate it a lot.  I hope I'm not asking too much, this is just frustrating for me.
0
 

Author Comment

by:Mouser
Comment Utility
I'm sorry, but I'm still confused on what you mean.  When I go to the ClassWizard in my project, it doesn't have a WM_DROPFILE message to edit.  The only member function that comes close to what your talking about is some function called an OnQueryDragIcon(), is this it?
However, if I make a call to OnDropFiles in my application, my program reconizes this function.  So how do I get to it within the wizard to place my code instead?
Thank you for helping me motigust,  I really appreciate it a lot.  I hope I'm not asking too much, this is just frustrating for me.
0
 

Author Comment

by:Mouser
Comment Utility
NEVERMIND!  I found what you were talking about.  You have to go to the events in order to edit the WM_DROPFILE message.

Thanks a lot for helping me motigust, I'm going to give you an A++ for being so patient and helping me.  Maybe you can help me with my other question, entitled, "Caps lock." Nobody can seem to help me with that one yet.
THANKS A LOT!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now