Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SHFILEOPSTRUCT and deletion ignoring or not the trash

SHFILEOPSTRUCT and deletion ignoring or not the trash

SHFILEOPSTRUCT and deletion ignoring or not the trash

(*Remark : this is not a question but a tip*)

I've implemented the deletion of files in my own develeopped file browser. For this, I use SHFILEOPSTRUCT and SHFileOperation. But as you may know, man can force real deletion of files (ignoring the trash) by pressing the shift key.

You should catch the state of the key shift to know if your application should really delete or not the files.

Set wFunc member to FO_DELETE, and construct a string containning filenames (this string contains '\0' between each filename and a double '\0' at the end) that you attach to pFrom. pTo member is ignored. You can set hwnd member to a real windows handle but you can also set it to NULL.

Then, set the FOF_ALLOWUNDO value of fFlags member to make the deletion moving files to the trash directory, or, if you want a real deletion, set fFlags to 0.

Note that if pFrom does not contain fully qualified path and filenames, this flag is ignored.

MSDN is not clear about this last value FOF_ALLOWUNDO. Now, it should be clear.

Have a nice day,

David Burg.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close