* Alf P. Steinbach:
* Alf P. Steinbach:
if (0 != SHFileOperationW(&info))
And... What's the actual code? So far you've only set up some buffers.
Oh I didn't see that: you've hidden the function call in an expression
inside an if, and use "W" at the end.
Well, that "W" won't work with your "_T" stuff if you compile for ANSI.
Decide on one or the other. Best is to avoid "_T".
Code that works (as per request):
<code>
#include <string>
#include <cassert>
#define STRICT
#define NOMINMAX
#define UNICODE
#define _UNICODE
#include <windows.h>
bool deleteDirectory( std::wstring const path )
{
std::wstring const paths = path + L'\0' + L'\0';
assert( paths.length() == path.length() + 2 );
SHFILEOPSTRUCT params = {};
params.wFunc = FO_DELETE;
params.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
params.pFrom = path.data();
return !SHFileOperation( ¶ms );
}
int main()
{
deleteDirectory( L"v:\\test\\bah" );
}
</code>
And, to top it off (I mean not seeing things today), add an "s": "paths.data()".
A: Because it messes up the order in which people normally read text.
A: Top-posting.