Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 3 Monaten
Beteiligte Autoren:
David van Pelt

DND From/To windows explorer

Startbeitrag von David van Pelt am 10.12.2013 09:24

Hey there,

I have created a small attachment management tool in our software.
Let me try to explain how it works it will help to understand my question.
We save the files as a binary memo in our database a table called attachents.
The control used to display the attachments is a looper, for each looper record 1 attachment.
So far so good, now to make it a bit sexy I wanted to use DND to make it easy to add files.
This was not as easy as I hoped, not cause creating it wasn't easy but keep it bug free.

I use "ExplorerAccept(True,Myself)" in the init of the looper,
and activated the "Drop from explorer WM_DROPFILES" code in the looper.
This was actually all quite easy I just had to make all controls invisible when dropping a file in the looper else you get a GPF error.
I use a thread to make them visible again cause the sequence of dropping the file should end completely before making them visible else you will still get the error.

Now here is the actual question, I would like to make it possible to grab the files from the looper (they aren't actual files just looper rows lol..),
and drop them back to the windows explorer. At this moment I just use a button and run the fselect, like this.

lsFilePath is string
larrListOfFiles is array of int

// Get all selected and define subscript.
FOR i = 1 _TO_ LooperCount(Loop_Attachments,toTotal)
IF Loop_Attachments..Selected = True THEN
// open the pick folder thingy
lsFilePath = fSelectDir("","Directory selection","Select a folder to export ALLthe selected files to.")
IF lsFilePath="" THEN
Error("No path was defined.")
// Saving!!!!!!
FOR EACH liAttachID OF larrListOfFiles
HReadSeekFirst(Attachments, AttachmentsID, liAttachID)
IF HFound(Attachments) THEN
IF fSaveBuffer(CompleteDir(lsFilePath)+Attachments.Name+"."...
+Attachments.Extension,Attachments.FileBinary)=False THEN
//Todo :D

Info("Attachments are saved.")

Anyway anyone who used dnd from your windev application to the outside world?
If you can help my out you will have my gratitude and I will never forget (Or maybe a year, can't make good promises about remembering stuff).



Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.