当前位置:主页>仓库管理软件> 列表

删除上网临时文件!!!!

财务软件版1楼: 老大们,帮帮忙!!!!
我用deltree,delfile等一些方法,都无法删除下面这个目录下的文件
C:\Documents and Settings\'' + Edt_UserName.Text + ''\Local Settings\Temporary Internet Files
有什么方法,请赐教!!!
分不够再开贴子补

2楼: 晚上来看

哪位兄台抄个MSDN的帮助也拿50分,真郁闷,早知道不帮你调代码了破解进销存软件

3楼: to chenybin 兄台;
能不能看看我的帖子 http://www.delphibbs.com/delphibbs/dispq.asp?lid=3218598

4楼: 楼主不好意思 ,借宝地一用.
帮你顶一下

5楼: 用 Norton SystemWorks 试试吧,很好用的系统优化软件啊~

6楼: 应该是删除他下面的目录和文件,不是删除他本身吧?

财务软件版7楼: chenybin,
对不起了,所以我再开一贴给你!
哦,对了,兄弟,再请教一下,在XP下如何删除,历史文件夹中的东西,这好像不是文件.。
C:\Documents and Settings\Administrator\Local Settings\History
什么今天,上周,我删除了,一会儿他又出现了里面的数据也没变

8楼: ff_ff
i服了u

9楼: 我把代码修改了一下,可以满足你的要求了,这次别加错分了,伤心啊:)



如果运行有问题,留下你的email,我把工程发给你

unit Main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, wininet,
StdCtrls, ComCtrls, Buttons, shlobj, ImgList, ShellApi;
type
TMainForm = class(TForm)
bbtnGetList: TBitBtn;
bbtnStop: TBitBtn;
bbtnDelAll: TBitBtn;
bbtnDelSel: TBitBtn;
ListView1: TListView;
Label1: TLabel;
Edit1: TEdit;
ImageList1: TImageList;
StatusBar1: TStatusBar;
procedure bbtnGetListClick(Sender: TObject);
procedure bbtnDelAllClick(Sender: TObject);
procedure bbtnStopClick(Sender: TObject);
procedure bbtnDelSelClick(Sender: TObject);
private
{ Private declarations }
IConList: TStringList;
function GetWinDir(Path: Integer): string;
procedure UpdateInfo(AText: string);
procedure UpdateOperInfo(AFlag: Integer; AFileName: string);
public
{ Public declarations }
Stop: Boolean;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;

var
MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.bbtnGetListClick(Sender: TObject);
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord;
dwEntrySize, dwLastError: LongWord;
ID: Integer;

function GetShellImage(AFileName: string): Integer;
var
Icon: TICon;
SHFileInfo: TSHFileInfo;
begin
Result := IConList.IndexOf(ExtractFileExt(AFileName));
if Result <> -1 then Exit;
Icon := TICon.Create;
SHGetFileInfo(Pchar(AFileName), 0, SHFileInfo, Sizeof(SHFileInfo), SHGFI_SMALLICON or SHGFI_ICON or SHGFI_USEFILEATTRIBUTES);
Icon.Handle := SHFileInfo.hIcon;
IConList.AddObject(ExtractFileExt(AFileName), Icon);
ImageList1.AddIcon(Icon);

Result := IConList.Count - 1;
Icon.ReleaseHandle;
end;

procedure AddInfo(lpEntryInfo: PInternetCacheEntryInfo; ID: Integer);
begin
with ListView1.items do begin
try
BeginUpdate;
with Add do begin
Caption := IntTostr(ID);
ImageIndex := GetShellImage(lpEntryInfo^.lpszLocalFileName);
subitems.Add(lpEntryInfo^.lpszSourceUrlName);
subitems.Add(ExtractFileName(lpEntryInfo^.lpszLocalFileName));
end;
finally
EndUpdate;
end;
end;
end;
begin
Stop := false;
ID := 0;
ListView1.items.clear;

dwEntrySize := 0;
FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);

GetMem(lpEntryInfo, dwEntrySize);

hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir <> 0 then
AddInfo(lpEntryInfo, ID);
ID := ID + 1;
FreeMem(lpEntryInfo);

repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize);
dwLastError := GetLastError();
if dwLastError = ERROR_INSUFFICIENT_BUFFER then begin
GetMem(lpEntryInfo, dwEntrySize);
if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then begin
AddInfo(lpEntryInfo, ID);
Inc(ID);
end;
FreeMem(lpEntryInfo);
end;
application.ProcessMessages;
until (dwLastError = ERROR_NO_MORE_ITEMS) or Stop;
ListView1.SetFocus;
ListView1.SelectAll;
end;

procedure TMainForm.bbtnDelAllClick(Sender: TObject);
var
I: Integer;
nRet: LongWord;
strEntryName: string;
begin
if not Stop then Exit;
for I := ListView1.items.Count - 1 downto 0 do begin

strEntryName := ListView1.items[I].subitems[0];
UpdateInfo(''准备删除 '' + strEntryName + ''……'');
DeleteUrlCacheEntry(Pchar(strEntryName));
nRet := GetLastError;
UpdateOperInfo(nRet, strEntryName);
end;
ListView1.items.clear;
end;

procedure TMainForm.bbtnStopClick(Sender: TObject);
begin
Stop := true;
end;

procedure TMainForm.bbtnDelSelClick(Sender: TObject);
var
I: Integer;
nRet: LongWord;
strEntryName: string;
begin
if not Stop then Exit;
for I := ListView1.items.Count - 1 downto 0 do begin
if ListView1.items[I].Selected then begin
strEntryName := ListView1.items[I].subitems[0];
UpdateInfo(''准备删除 '' + strEntryName + ''……'');
DeleteUrlCacheEntry(Pchar(strEntryName));
nRet := GetLastError;
UpdateOperInfo(nRet, strEntryName);
ListView1.items.Delete(I);
end;
end;
end;

constructor TMainForm.Create(AOwner: TComponent);
begin
inherited;
Stop := false;
Edit1.Text := GetWinDir(CSIDL_INTERNET_CACHE);
IConList := TStringList.Create;
end;

function TMainForm.GetWinDir(Path: Integer): string;
var
Pid: PItemIDList;
sPath: array[0..255] of char;
begin
try
SHGetSpecialFolderLocation(application.Handle, Path, Pid);
if SHGetPathFromIDList(Pid, sPath) then
{如果文件夹不是系统的一部分就返回False}
Result := StrPas(sPath);
except
UpdateInfo(''定位路径有误, 请再试!'');
end;
end;

destructor TMainForm.Destroy;
var
I: Integer;
begin
for I := IConList.Count - 1 downto 0 do
TICon(IConList.Objects[I]).Free;
IConList.Free;
inherited;
end;

procedure TMainForm.UpdateInfo(AText: string);
begin
StatusBar1.SimpleText := AText;
end;

procedure TMainForm.UpdateOperInfo(AFlag: Integer; AFileName: string);
begin
case AFlag of
0:
UpdateInfo(''删除 '' + AFileName + '' 成功!'');
ERROR_ACCESS_DENIED:
UpdateInfo(''删除 '' + AFileName + '' 失败!文本被保护!'');
ERROR_FILE_NOT_FOUND:
UpdateInfo(''删除 '' + AFileName + '' 失败!文件不存在!'');
end;
end;

end.

窗体文件
object MainForm: TMainForm
Left = 192
Top = 107
Width = 531
Height = 359
BorderIcons = [biSystemMenu, biMinimize]
Caption = ''删除IE临时文件示例''
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = ''宋体''
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 12
object Label1: TLabel
Left = 20
Top = 8
Width = 120
Height = 12
Caption = ''当前用户IE临时文件夹''
end
object bbtnGetList: TBitBtn
Left = 437
Top = 140
Width = 75
Height = 25
Caption = ''获取列表''
TabOrder = 0
OnClick = bbtnGetListClick
end
object bbtnStop: TBitBtn
Left = 437
Top = 184
Width = 75
Height = 25
Caption = ''停止获取''
TabOrder = 1
OnClick = bbtnStopClick
end
object bbtnDelAll: TBitBtn
Left = 437
Top = 224
Width = 75
Height = 25
Caption = ''删除所有''
TabOrder = 2
OnClick = bbtnDelAllClick
end
object bbtnDelSel: TBitBtn
Left = 437
Top = 268
Width = 75
Height = 25
Caption = ''删除选中''
TabOrder = 3
OnClick = bbtnDelSelClick
end
object ListView1: TListView
Left = 20
Top = 60
Width = 405
Height = 233
Columns = <
item
Caption = ''序号''
end
item
Alignment = taCenter
Caption = ''Internet地址''

Width = 250
end
item
Caption = ''真实文件名''
Width = 100
end>
MultiSelect = True
ReadOnly = True
RowSelect = True
SmallImages = ImageList1
TabOrder = 4
ViewStyle = vsReport
end
object Edit1: TEdit
Left = 20
Top = 28
Width = 405
Height = 20
BevelEdges = []
BevelInner = bvNone
BevelKind = bkTile
Color = clBtnFace
ImeName = ''中文 (简体) - 拼音加加3.11''
TabOrder = 5
end
object StatusBar1: TStatusBar
Left = 0
Top = 310
Width = 523
Height = 22
Panels = <>
SimplePanel = False
end
object ImageList1: TImageList
Left = 436
Top = 104
end
end

10楼: chenybin
http://www.zxtextile.com.cn/xingai.rar
我用这个软件查找,其它都可以清楚,就是这个软件中的强力恢复上网记录,不能清除。
请老大指教,
能不能留个qq

11楼: 是不是跟那个临时文件夹下面的index.dat,有关|?

12楼: 委屈一下,留下你的QQ吧



另外,强力恢复可能是软件里面自己保存了,我用的都是标准的API,没有问题的简单进销存软件

13楼: qq:76135178
这是我的qq号码,

软件中的强力恢复上网记录,好像是读取index.dat里面的数据的

财务软件版14楼: loner_meme@163.com
这是我的email

15楼: 先改名再删除

16楼: 谢谢大家