Board index » cppbuilder » BCB6: Recycle with SHFileOperation
poojo hackma
CBuilder Developer |
BCB6: Recycle with SHFileOperation2006-02-03 06:19:37 AM cppbuilder44 Does Borland have a way to send things to the Recycle Bin, or is SHFileOperation the solution? If SHFileOperation is the way to go, could someone show me how to populate the SHFILEOPSTRUCT field for it? Specifically pFrom and pTo. I understand pFrom to be the file I want to act on, but want about pTo? #include <vcl> #include <shellapi.h> // ... // ... void TForm1::Recycle(char* file) { SHFILEOPSTRUCT op; char from[MAX_PATH + 2] = {0}; strncpy(from, file, MAX_PATH); // leaves me 2 NULL characters op.hwnd = NULL; op.wFunc = FO_DELETE; op.pFrom = from; // op.pTo = ? op.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION; if (SHFileOperation(&op) != 0) MessageBox(NULL, "Didn't work.", "Error", MB_OK); } |