Solved

SHFileOperation problem

Posted on 2004-04-13
8
207 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:rpatna
  • 3
  • 2
8 Comments
 
LVL 4

Accepted Solution

by:
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
0
 
LVL 3

Expert Comment

by:akalmani
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.
0
 

Author Comment

by:rpatna
ID: 10831822
how to use CFile to copy entire folder and delete entire folder?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:akalmani
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.
0
 
LVL 3

Expert Comment

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

Author Comment

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now