?
Solved

Putting in Rcyc bin

Posted on 2005-05-14
3
Medium Priority
?
144 Views
Last Modified: 2010-04-05
I have a program that puts files in the recyc bin, but if the file is in use it displays a system error saying access denied.  It does this even when I put Try... Except around it.  How can I get this to just bypass the file without a message display from the system?  (I'm using D5)

 Try
  with FileOpStruc do
  begin
    Wnd := 0;
    wFunc := FO_DELETE;
    pFrom := Pchar(s + #0 + #0);
    fFlags := FOF_ALLOWUNDO;
  end;
 Except
   //continue
 End;
0
Comment
Question by:jexd99
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Slick812 earned 500 total points
ID: 14003946
hello  jexd99, , the  API function   SHFileOperation(  )  does not seem to throgh an exception, this is a System function not a Delphi fuction, (so you get a system error message, not an exception message), so I do not think that the try  and   except  block will do anything at all for this. . . You should try and add the flags -

FOF_NOCONFIRMATION  or  FOF_SILENT

like

fFlags := FOF_ALLOWUNDO or FOF_NOCONFIRMATION  or  FOF_SILENT;

and see if that might help, but sometimes the system will show an "Error" message, even with those flags, depending on the error
0
 

Author Comment

by:jexd99
ID: 14004242
Thanks, I did experiment with those flags already (I thought nonconfirmation would work, but it doesn't).  I could check to see if the file is in use first, but I would rather just check it at the time of deleting as there has to be a way to handle this.
0
 

Author Comment

by:jexd99
ID: 14004420
Consider it good, it now works :)  I made so many changes that I'm not sure exactly which one caused it to work, but one of the changes was the combo of all 3 you listed above, so I think that might have been the main piece for this!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

864 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