SHFileOperation problem

Posted on 2004-04-13
Last Modified: 2013-11-20
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.
Question by:rpatna
  • 3
  • 2

Accepted Solution

bkfirebird earned 50 total points
ID: 10820269
i don't think there is a error function specific for shell functions ... your best bet would be to try GetLastError

Expert Comment

ID: 10821279
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.

Author Comment

ID: 10831822
how to use CFile to copy entire folder and delete entire folder?
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.


Expert Comment

ID: 10840461
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.

Expert Comment

ID: 11125767
The asker did not get back even though, gave him some hints/solutions

Author Comment

ID: 11140282
no comment is my solution. so admin can close this.

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 64
Excel Use VBA to get user's Mac Address for their computer 5 166
centeredAverage challenge 8 164
Annoying "thing" blocks my view 4 100
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question