Hi all

I'm back with some more OLE DragDrop.

In this case it's a concept I've been developing for the last couple of days (please see my older post on OLE DragDrop for some more info on the subject):

I was really pissed by the fact that there is no way for the IDataSource to know where the CF_HDROP files are going to be copied/moved in the shell (i.e. I drop a file from my program in Explorer but I've no clue where it goes).
Being able to get the destination directory is a great way to easily implement drag-drop with the Explorer without having to handle all the data "stuff" in the IDataObject interface.

My solution might not be the most elegant but apparently it works.
For the moment suffice to know that it's based on the undocumented API SHChangeNotifyRegister

Before giving the source to the masses I'd like some of you to test the proggie on your machines (I only have W2K PCs).

Just run it ... drag and drop the list item in any of your directories and you should get a MessageBox showing you where the file has been dropped (note that no real file will be created in your HD ... it's just a dummy)

Grateful to all those that will try it and will let me know the result

ps:sorry, but my English is not in tip-top conditions today
Posted on 2002-01-14 11:59:11 by random
On a Win98 orgional recipy machine:

I tried dropping on a number of targets, I got a correct responce every time. I tried to fool it by dropping into the 'root' image of MyDocuments, it correctly got that folder was actually under C:\

Next I tried dropping into a folder on the desktop. BINGO! It got that right too.

Hey! It works!

PS My english is rairly in tip top condinion even on a good day.
Posted on 2002-01-14 21:52:52 by Ernie
win2K pro here
works perfectly :)
Posted on 2002-01-14 22:24:30 by Hiroshimator
works on WinNT

strangely enough if I select a .ZIP file as a drop Target, its "hilighted" and if I drop it, the messagebox displays "C:\WINNT\Administrator\Recent", although the zip file is in C:\TEMP

Posted on 2002-01-15 03:07:51 by japheth

Works as advertised on WinME.

Posted on 2002-01-15 03:08:16 by gscundiff
Ok ... here's the code. Have fun and let me know what you think

Japhet: I'm relying on you for the debugging :-) As for winzip, the way its context handler works is pretty weird.

Posted on 2002-01-15 17:48:04 by random
There is a small delay between the drag & drop and the displaying of the MessageBox... is it normal ?

(Win98 IE 6.0) It is my office box, I will try tonight with my Win2k one at home...

Good work ;)
Posted on 2002-01-17 10:59:44 by JCP
the delay is normal, as it is the time to go through the OLE overhead + the windows' notification delay.
It's the same delay you get when you drop a file in a directory and wait for the explorer's folder to refresh in order to display the new file.


ps: I'm really getting hooked with NAN's and Thomas's OOP model. GREAT WORK guys. I'm creating some CClasses as CTreeView and CListView (hopefully not as bloated as the MFC) for a start and the resulting source code, when using them, looks neat. Might be a big work to create the classes at the beginning but should be great for reusability in the future. Sweet.
Posted on 2002-01-18 04:36:54 by random
Thats the idea... :)

I'm thinking of makin a separate download page on my home page for "sharing" classes (with proper credit to the authors). As well Thomas may add some "extra" features to the new Creator Tool to driectly Access pages like this, to hopefully get a code-bank going (in time).

Anywho, if your ok with it, E-mail me what you would like posted.

Have fun!, and glad you like it!
PS: If you find any drawbacks or issues you think should change please feel free to post/email us so we can check it out :) Thanx

Posted on 2002-01-18 11:37:50 by NaN

for my application, i search to find the file name which is modified in a directory. I use FindNextChangeNotification but that does not enable me to find the name. The example of ramdom with "SHChangeNotifyRegister" seems the solution. Does somebody have this example, or a example of code?

Thanks for your help,

Posted on 2005-01-10 21:11:51 by Faiseur
You may find a - slightly modified - version of Random's sample at this link : http://www.japheth.de/download/dragdrop.zip

view the MASM32 page on my site - includes a version of windows.inc which should work - in case you get assembler errors
Posted on 2005-01-11 04:40:14 by japheth
Hi japhet,

Many thanks ! I will look at this version attentively.
Posted on 2005-01-11 05:28:38 by Faiseur