How to Move files into trashbox?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jianren Lu

    How to Move files into trashbox?

    Dear all,
    Could you please tell me how to move files into trashbox?
    FileInfo.Delete () will delete files completely. But I want to get
    files back if necessary. I searched document of .net framework 1.1,
    but it seems like no such information.

    JR
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: How to Move files into trashbox?

    Jianren,

    You will have to use the SHFileOperation function through the P/Invoke
    layer. You will need to define the SHFILEOPSTRUCT structure. Once you do
    that, you can create an instance, and set the wFunc field to FO_DELETE and
    the fFlags field to FOF_ALLOWUNDO. The pFrom field should be set to the
    name of the file to delete.

    For a VB example, check out knowledge base article 154005, located at
    (watch for line wrap):



    If you need help converting the code for use in C#, let us know.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(dot)paldin o=at=exisconsul ting<dot>com

    "Jianren Lu" <lu@ils.uec.ac. jp> wrote in message
    news:150b8982.0 310080132.26c28 b2d@posting.goo gle.com...[color=blue]
    > Dear all,
    > Could you please tell me how to move files into trashbox?
    > FileInfo.Delete () will delete files completely. But I want to get
    > files back if necessary. I searched document of .net framework 1.1,
    > but it seems like no such information.
    >
    > JR[/color]


    Comment

    • Jianren Lu

      #3
      Re: How to Move files into trashbox?

      thank you for your help!
      I am a newbie to C#, and I don't know VB, so if possible, could you
      please help me convert the VB sample code into C#?
      thank you very much!
      JR



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...