Re: SHFileoperation question
- From: "andré m.a" <a.m.a@xxxxxxxxxxxx>
- Date: Thu, 26 May 2005 17:21:08 -0400
Here's some routine i've used in a distributed application.
The move operation depends on the path.
If the path contains only a folder then you're moving a folder
If the path contains a filename, then you're moving a file etc...
As Igor mentioned, you need 2 nuls at end of paths.
( the method MoveFolder below adds the second. )
....
#include <string>
using namespace std ;
....
BOOL MoveFolder(string &from, string &to)
{
string f(from);
f+='\0';
string t(to);
t+='\0';
SHFILEOPSTRUCT fo;
ZeroMemory(&fo, sizeof(SHFILEOPSTRUCT));
fo.wFunc = FO_MOVE;
fo.pFrom = f.c_str();
fo.pTo = t.c_str();
fo.fFlags = FOF_SILENT|FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR;
if( SHFileOperation(&fo) != 0 )
return FALSE;
return TRUE;
}
.
- References:
- Re: SHFileoperation question
- From: thatsalok
- Re: SHFileoperation question
- Prev by Date: Re: any one know a macro trick to solve this ?
- Next by Date: Re: Performance: Iterating a vector in a loop..
- Previous by thread: Re: SHFileoperation question
- Next by thread: Re: SHFileoperation question
- Index(es):
Relevant Pages
|
Loading