Announcement

Collapse
No announcement yet.

Sending files to the recycle bin from PDLL6

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending files to the recycle bin from PDLL6

    I've tried unsuccessfully several options to send a file to the recycle bin instead to delete. Do you have an option to do this?
    I've saw in the forum in December a proposal but it just kill the file and is unrecoverable in the bin.
    regards

  • #2
    see: http://www.powerbasic.com/support/pb...ad.php?t=22533

    ------------------

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

    Comment


    • #3
      Agustin, did you try the code in the December thread? Did you experiment with the flags. Also note that the code contains one short-comming - the ASCIIZ string that holds the filename should be dimensioned to %MAX_PATH, not the 63 characters that code allows.

      Also, there is no need to add the trailing CHR$(0) as the compiler does this for you anyway. Further, instead of even needing to use a local ASCIIZ string, the string passed to the function can be used directly, by deleting the ASCIIZ string code, and changing:
      shfo.pFrom = VARPTR(szSource)
      to
      shfo.pFrom = STRPTR(FilNam)

      ALso, the (SHFileOperation() API) requires the fully qualified path of the target file.
      C:\MYAPPDIR\LIVEDATA\ARCHIVES\ARC1999\ARC365.ZIP

      Let us know if this works for you. If not, provide the code you are using, and details of your O/S.


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Recycle Bin, similar wife, should keep silence

        Code:
           #Compile Exe
           #Register None
           #Dim All
           #Include "WIN32API.INC"
        
           Sub DeleteToRecycleBin (szSource As String)
              Static shfo As SHFILEOPSTRUCT
              shfo.wFunc = %FO_DELETE
              shfo.pFrom = StrPtr(szSource)
              shfo.fFlags = %FOF_ALLOWUNDO Or %FOF_NOCONFIRMATION Or %FOF_SILENT Or _
                            %FOF_NOCONFIRMMKDIR Or %FOF_RENAMEONCOLLISION
              SHFileOperation shfo
           End Sub
           
           Function PbMain()
              DeleteToRecycleBin "C:\Tmp.Bas" ' File
              DeleteToRecycleBin "D:\Tmp.Dir" ' Directory
           End Function
        ------------------

        Comment


        • #5
          Thanks for the useful corrections, Lance!

          ------------------

          Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
          http://zijlema.basicguru.eu
          *** Opinions expressed here are not necessarily untrue ***

          Comment


          • #6
            Thanks Lance, Egbert and Semen. Now it is working fine!
            Best regards.

            ------------------

            Comment

            Working...
            X