Page 1 of 1

DragFiles(Files$ [, Actions [, returnPathOnly]])

Posted: Sun May 03, 2009 7:04 pm
by Joakim Christiansen
EDIT:
But I actually used my brain and came up with this:
http://www.purebasic.fr/english/viewtopic.php?t=37325

What I suggest is the optional argument returnPathOnly.
Because I need to be able to call DragFiles so I get the "drag interface" but when I drop it I need to be able to just get the directory where it was dropped (if in a directory). This is so I can then in a thread transfer the files there using my OWN method, because I need to transfer the files from my server and it will take some time.

But in the meantime I would love to get any tips on how to get that path. Doesn't the "internal system" of PB know it when the command is used?

Posted: Sun May 03, 2009 8:00 pm
by freak
This is not possible because the drag destination is responsible for doing the copying (usually this is the explorer). The drag source doesn't know where the files are going. In fact, the drag destination actually defines what "copy" means. It could well be that the target doesn't want to make a copy at all and just read the file instead.

Just put your files on the local disk first and then call DragFiles(). This is the way other programs are doing it as well.

Posted: Sun May 03, 2009 11:28 pm
by Joakim Christiansen
Thanks for the explanation!
freak wrote:Just put your files on the local disk first and then call DragFiles(). This is the way other programs are doing it as well.
Oh, well I can't use it then. Because my program will need to download the files in the background (thread) and that can take several minutes, I don't want to freeze the program before I call DragFiles(). And if I do it in a thread (the whole start the downloads and call DragFiles() stuff) then I can't know that DragFiles() will get the right information anymore when it finally executes can I? Because I can have dragged files to lots of other folders in the meantime.

Guess I'll need to find a way to "hook" into the window by using its handle and see if I can get any useful information that way.

EDIT:
Haha, my experiments shows that a little delay before calling DragFiles() ruins the whole thing (at least the experience). Also that calling it from a thread will not work. So yeah, it can't be used at all in my situation, damn Windows.

EDIT 2:
But I actually used my brain and came up with this:
http://www.purebasic.fr/english/viewtopic.php?t=37325