>>LOCAL Demo AS PDFDragNDropper >> >>m.Demo = CREATEOBJECT("PDFDragNDropper") >>m.Demo.Show(1) >> >>DEFINE CLASS PDFDragNDropper AS Form >> >> OLEDropMode = 1 >> * set this to the location of the repository >> Repository = ADDBS(SYS(2023)) + "PDFRepository" >> >> FUNCTION Init >> IF !DIRECTORY(This.Repository) >> MKDIR (This.Repository) >> ENDIF >> ENDFUNC >> >> FUNCTION OLEDragOver >> LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState >> LOCAL ARRAY DragFiles(1) >> >> IF m.nState = 0 >> IF m.oDataObject.GetData(15, @m.DragFiles) AND UPPER(JUSTEXT(m.DragFiles(1))) == "PDF" >> This.OLEDropHasData = 1 >> This.OLEDropEffects = 1 >> ENDIF >> ELSE >> IF m.nState = 1 >> This.OLEDropHasData = -1 >> ENDIF >> ENDIF >> >> ENDFUNC >> >> FUNCTION OLEDragDrop >> LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord >> LOCAL ARRAY DragFiles(1) >> LOCAL SourceFile AS String >> LOCAL DestinationFile AS String >> >> DIMENSION m.DragFiles(1) >> IF m.oDataObject.GetData(15, @m.DragFiles) >> WAIT WINDOW "Copying.." NOWAIT NOCLEAR >> FOR EACH m.SourceFile IN m.DragFiles >> IF UPPER(JUSTEXT(m.SourceFile)) == "PDF" >> m.DestinationFile = ADDBS(This.Repository) + JUSTFNAME(m.SourceFile) >> STRTOFILE(FILETOSTR(m.SourceFile), m.DestinationFile, 0) >> ENDIF >> ENDFOR >> WAIT WINDOW "Done!" NOWAIT >> m.nEffect = 1 >> ELSE >> m.nEffect = 0 >> ENDIF >> >> ENDFUNC >> >>ENDDEFINE >>>