C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-18-2009, 03:27 PM   #1
Registered User
 
Join Date: Jan 2008
Posts: 42
Question Can't delete Thumbnail Cache under Windows 7

Hi,

under Vista, i used to delete my Thumbnail Cache files :

Quote:
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_32.db
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_96.db
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_256.db
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_1024.db
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_idx.db
AppData\Local\Microsoft\Windows\Explorer\thumbcach e_sr.db
with the following Code:

Code:
if ( !DeleteFile( filesC.Item( i ) ) )
{
	DWORD dwAttC = GetFileAttributes( filesC.Item( i ) );
	dwAttC &= ~( FILE_ATTRIBUTE_READONLY );

	SetFileAttributes( filesC.Item( i ), dwAttC );

	DeleteFile( filesC.Item( i ) );
}
after restarting explorer.exe, those files are automatically regenerated.

Under Windows 7 this is not the case, those files are not deleted or regenerated even after restarting the system.

Am i missing something, or there is some way to notify explorer.exe to delete those files?


Thanks in advance.
patrick22 is offline   Reply With Quote
Old 06-19-2009, 01:01 AM   #2
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
I'm guessing you need to look at the return result of DeleteFile() and generate some kind of meaningful error message.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 06-19-2009, 03:53 AM   #3
Registered User
 
Join Date: Jan 2008
Posts: 42
Under Vista:

-The first call to DeleteFile returns 0, and GetLastError returns ERROR_ACCESS_DENIED.
-After changing the file attribute, DeleteFile returns non-zero value(success).
-Thumbnails are regenerated automatically after restarting explorer.exe.

Under Windows 7:

-The first call to DeleteFile returns 0, and GetLastError returns ERROR_ACCESS_DENIED.
-After changing the file attribute, DeleteFile returns 0, and GetLastError returns again ERROR_ACCESS_DENIED.
-Thumbnails are not deleted or regenerated even after restarting the System.
patrick22 is offline   Reply With Quote
Old 06-19-2009, 04:36 AM   #4
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
Well there you go then - you have the answer.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 06-19-2009, 12:33 PM   #5
Unregistered User
 
Yarin's Avatar
 
Join Date: Jul 2007
Posts: 925
Quote:
Under Windows 7 this is not the case, those files are not deleted or regenerated even after restarting the system.
Quote:
-Thumbnails are not deleted or regenerated even after restarting the System.
I don't get it. If you can't delete the files in the first place, how would you know wether or not they get re-created??

As for deleting them, try blanking out the file's security descriptor before deleting and see if it works.
__________________
GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64
Yarin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proper Usage of the delete Operator thetinman C++ Programming 7 04-25-2007 11:53 PM
Dialog Box Problems Morgul Windows Programming 21 05-31-2005 05:48 PM
dual boot Win XP, win 2000 Micko Tech Board 6 05-30-2005 02:55 PM
delete and delete [] Lionel C++ Programming 8 05-19-2005 01:52 PM
FlashWindowEx not declared? Aidman Windows Programming 3 05-17-2003 02:58 AM


All times are GMT -6. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22