Solved

drag & drop

Posted on 1998-11-14
6
240 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
[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
  • 4
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
motigust earned 90 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
Industry Leaders: 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!

 

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

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

733 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