Posts Tagged ‘SHFileOperation’

Delete a file to the recycle bin from C++

Friday, November 14th, 2008

Today, I was looking for a way to delete a file to the recycle bin using C++, but couldn’t find any simple example, so here it is:

SHFILEOPSTRUCT operation;
operation.wFunc = FO_DELETE;
operation.pFrom = "c:\\file\to\delete.txt";
operation.fFlags = FOF_ALLOWUNDO;

SHFileOperation(&operation);
Copyright © Pogopixels Ltd, 2008-2018