?
Solved

drag & drop

Posted on 1998-11-14
6
Medium Priority
?
258 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 360 total points
ID: 1324709
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
ID: 1324710
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
ID: 1324711
Use the wizard to override the WM_DROPFILE message,
then you will have a function that gets DropInfo as parametes.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Mouser
ID: 1324712
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
ID: 1324713
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
ID: 1324714
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

864 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