Solved

drag & drop

Posted on 1998-11-14
6
234 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Looking for a specific application/software 2 114
if loop in java 3 153
zeroFront challenge 7 112
fix34  challenge 9 143
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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