|
-
May 27th, 2002, 07:51 PM
#1
SHFileOperation
I can not get SHFileOperation to rename a file the error I get is "Cannot rename file: Select only one file to rename, or use MS-Dos wildcards for example (*.txt) to rename a group of files with similar names." I have no idea where this error comes from because I am creating an explorer like listctrl and I only have one file selected to rename. Here is the code below, any help to solve this problem or working code to RENAME a file would be good. Thank you.
// Get file paths
...
// Set up structures
memset(&sOpStruct, 0, sizeof(sOpStruct));
sOpStruct.pFrom = strSource;
sOpStruct.pTo = strTarget;
sOpStruct.hwnd = GetSafeHwnd();
sOpStruct.wFunc = FO_RENAME;
sOpStruct.fFlags = FOF_ALLOWUNDO;
sOpStruct.fAnyOperationsAborted = FALSE;
sOpStruct.hNameMappings = NULL;
sOpStruct.lpszProgressTitle = NULL;
// Run
if (!SHFileOperation(&sOpStruct))
{
}
else
{
}
-
May 29th, 2002, 04:42 AM
#2
I guess that strSource or strTarget or both of them are incorrect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|