Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SHFILEOPSTRUCT and deletion ignoring or not the trash

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
(*Remark : this is not a question but a tip*)<br><br>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.<br><br>You should catch the state of the key shift to know if your application should really delete or not the files.<br><br>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.<br><br>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.<br><br>Note that if pFrom does not contain fully qualified path and filenames, this flag is ignored.<br><br>MSDN is not clear about this last value FOF_ALLOWUNDO. Now, it should be clear.<br><br>Have a nice day,<br><br>David Burg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top