LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to delete all files in RECYCLER.

Does that mean that it's now working for you?

If not, try my example.

 

I have a couple of comments about your statement SHEmptyRecycleBinA(0,NULL,1);

 

Why force the use of SHEmptyRecycleBinA() instead of SHEmptyRecycleBin and letting the header file choose between SHEmptyRecycleBinA and SHEmptyRecycleBinW?

 

The documentation for SHEmptyRecycleBin() states that the first parameter can be NULL.  You used 0 instead, which may work, but to be strict you should use NULL as in my example.

 

For the last parameter (dwFlags), you explicitly used 1.  When constants are defined in a header file, you should use them by name, not by value.  If the value (or the meaning of it) were to change in the future, you wouldn't get surprised by some unexpected behavior.  It's also self documenting.  You can look at the statement SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION); and guess that it will not ask you to confirm emptying the recycle bin, but looking at SHEmptyRecycleBin(NULL, NULL, 1);, you have no idea what the 1 is for.

 

You can also add the constants together to specify additional options.  For example:

SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION + SHERB_NOPROGRESSUI + SHERB_NOSOUND);

0 Kudos
Message 11 of 11
(1,027 Views)