Hello.
I wanted to copy a single file to another location, using shell functions. So I did this:
I tried above code so many times but never worked. I don’t get any errors though, the file/folder just doesn’t get copied.Code:// ******** get path **************** char path[_MAX_PATH]; SHGetPathFromIDList ( pidl, path ); // ******** file operation ************ SHFILEOPSTRUCT fopstruct; fopstruct.hwnd = NULL; // parent wnd fopstruct.wFunc = FO_COPY; // flag fopstruct.pFrom = path; // path of the object user selects from browse for folder dialog box fopstruct.pTo = "E:\cookies"; // destination BOOL foCheck = SHFileOperation ( &fopstruct );
So I tried hard coding a path into pFrom, member of SHFILEOPSTRUCT:
Then the file got copied properly into “E:\cookies”. But I think I cannot rely on hard coded paths.Code:fopstruct.pFrom = “E:\Debug”;
Also, when I tried to delete a file/folder suing FO_DELETE flag, it didn’t worked either, even when I hard coded the path.
Why these things are happening? How can I fix them? Please help.
Thanks a lot for reading.
-geek@02



LinkBack URL
About LinkBacks


