rpatna
asked on
SHFileOperation problem
Hi,
I'm usingh SHFileOperation function to copy and remove folder.
this function Returns zero if successful, or nonzero otherwise.
if it returns nonzero, then how I know that what are the actual problem.
I'm getting nonzero returns value when their is no space in harddisk. in this condition I want to display the message "No disk space"
so, how I know the real problem on nonzero returns.
I'm usingh SHFileOperation function to copy and remove folder.
this function Returns zero if successful, or nonzero otherwise.
if it returns nonzero, then how I know that what are the actual problem.
I'm getting nonzero returns value when their is no space in harddisk. in this condition I want to display the message "No disk space"
so, how I know the real problem on nonzero returns.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not use CFile which throws an exception in case of an error and you can handle accordingly. Using SHFileOperation() you must validate all the inputs before carrying out the operation.
ASKER
how to use CFile to copy entire folder and delete entire folder?
Oops i am sorry I did not read MSDN clearly though..CFile works only for files. bkfirebird is right. Use GetLastError() to find if any error has occurred. Also make a check for fAnyOperationsAborted flag after the operation. As such the function just returns boolean value. Its a known issue of SHFileOperation() API.
Best way to do is write a recursive function which does file copy recursively.
Best way to do is write a recursive function which does file copy recursively.
The asker did not get back even though, gave him some hints/solutions
ASKER
no comment is my solution. so admin can close this.