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.
rpatnaAsked:
Who is Participating?
 
bkfirebirdCommented:
i don't think there is a error function specific for shell functions ... your best bet would be to try GetLastError
0
 
akalmaniCommented:
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.
0
 
rpatnaAuthor Commented:
how to use CFile to copy entire folder and delete entire folder?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
akalmaniCommented:
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.
0
 
akalmaniCommented:
The asker did not get back even though, gave him some hints/solutions
0
 
rpatnaAuthor Commented:
no comment is my solution. so admin can close this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.