Click to See Complete Forum and Search --> : Selecting Files in Explorer
Rajaraman
May 28th, 1999, 03:46 AM
I use an ODBC database with MFC. The user selects a few recrods from the data base, which are no more than file names on the hard disk. Now the user has to transfer the selected files to an archive by just drag & drop. (The backup utility program's window accepts files dropped into it from explorer).
I have opened Explorer from my program, but then how to programmatically select the desired files? It is enough if these files are highlighted in explorer, to enable me drag them away.
Rajaraman
BrianOG
May 28th, 1999, 08:22 AM
I am not sure I correctly understand what you are trying to do, but the most common case for something like this, is that you launch Explorer, then the user selects files in explorer and drags them onto your window.
If this is indeed the case, you will need to catch the WM_DROPFILES message and iterate through the list of files passed to you. (See doc for WM_DROPFILES & CWnd::OnDropFiles for more info).
Rajaraman
May 31st, 1999, 03:00 AM
Sorry, I suppose I have not made my requirements clear enough :
1) The program I am writing is called program A.
2) Program A launches two other processes, Windows Explorer and another program called B. This B is a third party program which accepts dropped files.
3) The user has to drag a number of files from Explorer, and drag them to Program B.
4) But the problem is, the user has no idea what files to select. Only my Program A knows this from its data base. The actual file names are automatically generated, cryptic names like A77B_2365XY.TTY and so on.
5) So the task now is : Program A has to send a message through DDE or COM to Explorer. In response, Explorer will open the relevant folder and select all the files specified.
6) Now the user simply drags the highlighted files from explorer to the Progm B.
It may even be possible to communicate the file names directly from Prgram A to B, altogether bypassing Explorer. I other words, Program A simulates a drag from Explorer.
The question is : what message to send to B, and in what format to communicate the file names ?
Rajaraman
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.