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?
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.


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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 49
Different colored text in ComboBox without Subclassing 8 65
repeateFront java challenge 31 94
has77  challenge 9 87
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

791 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