?
Solved

drag & drop

Posted on 1998-11-14
6
Medium Priority
?
248 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 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

764 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