删除IE的临时文件 100分结贴迅速

hmgujie 2008-07-10 04:23:43
C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files 怎么删除这个文件下的所有文件 比如像Cookie:administrator@www.sogou.com/这样的文件 普通删除不了 高手指点下
...全文
351 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
liyoubaidu 2009-07-26
  • 打赏
  • 举报
回复
up
jinjazz 2008-07-10
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 hyruur 的回复:]
只有调用API函数删,最好的方法将硬盘格式化
[/Quote]
治牙疼最好的办法是所有牙都敲了,脚上被蚊子咬了最好的办法是截肢...
cychris 2008-07-10
  • 打赏
  • 举报
回复
学习.....
我很懒 2008-07-10
  • 打赏
  • 举报
回复
只有调用API函数删,最好的方法将硬盘格式化
格拉 2008-07-10
  • 打赏
  • 举报
回复
学习!
Code従業員 2008-07-10
  • 打赏
  • 举报
回复
学习,顶
yagebu1983 2008-07-10
  • 打赏
  • 举报
回复
学习ericzhangbo1982111!!!!
这么多的代码啊!!!
UP!!!
ericzhangbo1982111 2008-07-10
  • 打赏
  • 举报
回复
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.IO;

namespace UrlHistoryLibrary
{
/// <summary>
/// The class that wraps the C# equivalence of the IURLHistory Interface (in the file "urlhist.cs")
/// </summary>
public class UrlHistoryWrapperClass
{

UrlHistoryClass urlHistory;
IUrlHistoryStg2 obj;

/// <summary>
/// Default constructor for UrlHistoryWrapperClass
/// </summary>
public UrlHistoryWrapperClass()
{

urlHistory = new UrlHistoryClass();
obj = (IUrlHistoryStg2)urlHistory;
SHDocVw.ShellUIHelper h=new SHDocVw.ShellUIHelper();
string o="aaa";
object x=(object)o;
h.AddFavorite("http://www.sina.com", ref x);





}

/// <summary>
/// Clean up any resources being used.
/// </summary>
public void Dispose()
{
Marshal.ReleaseComObject(obj);
urlHistory = null;
}

/// <summary>
/// Places the specified URL into the history. If the URL does not exist in the history, an entry is created in the history. If the URL does exist in the history, it is overwritten.
/// </summary>
/// <param name="pocsUrl">the string of the URL to place in the history</param>
/// <param name="pocsTitle">the string of the title associated with that URL</param>
/// <param name="dwFlags">the flag which indicate where a URL is placed in the history.
/// <example><c>ADDURL_FLAG.ADDURL_ADDTOHISTORYANDCACHE</c></example>
/// </param>
public void AddHistoryEntry(string pocsUrl, string pocsTitle, ADDURL_FLAG dwFlags)
{
obj.AddUrl(pocsUrl, pocsTitle, dwFlags);

}

/// <summary>
/// Deletes all instances of the specified URL from the history. does not work!
/// </summary>
/// <param name="pocsUrl">the string of the URL to delete.</param>
/// <param name="dwFlags"><c>dwFlags = 0</c></param>
public void DeleteHistoryEntry(string pocsUrl, int dwFlags)
{

try
{
obj.DeleteUrl(pocsUrl, dwFlags);
}
catch (Exception ex)
{

}


}


/// <summary>
///Queries the history and reports whether the URL passed as the pocsUrl parameter has been visited by the current user.
/// </summary>
/// <param name="pocsUrl">the string of the URL to querythe string of the URL to query.</param>
/// <param name="dwFlags">STATURL_QUERYFLAGS Enumeration
/// <example><c>STATURL_QUERYFLAGS.STATURL_QUERYFLAG_TOPLEVEL</c></example></param>
/// <returns>Returns STATURL structure that received additional URL history information. If the returned STATURL's pwcsUrl is not null, Queried URL has been visited by the current user.
/// </returns>
public STATURL QueryUrl(string pocsUrl, STATURL_QUERYFLAGS dwFlags)
{

STATURL lpSTATURL = new STATURL();

try
{
//In this case, queried URL has been visited by the current user.
obj.QueryUrl(pocsUrl, dwFlags, ref lpSTATURL);
//lpSTATURL.pwcsUrl is NOT null;
return lpSTATURL;
}
catch (FileNotFoundException)
{
//Queried URL has not been visited by the current user.
//lpSTATURL.pwcsUrl is set to null;
return lpSTATURL;
}

}

/// <summary>
/// Delete all the history except today's history, and Temporary Internet Files.
/// </summary>
public void ClearHistory()
{

obj.ClearHistory();

}



/// <summary>
/// Create an enumerator that can iterate through the history cache. UrlHistoryWrapperClass does not implement IEnumerable interface
/// </summary>
/// <returns>Returns STATURLEnumerator object that can iterate through the history cache.</returns>
public STATURLEnumerator GetEnumerator()
{
return new STATURLEnumerator((IEnumSTATURL)obj.EnumUrls);
}

/// <summary>
/// The inner class that can iterate through the history cache. STATURLEnumerator does not implement IEnumerator interface.
/// The items in the history cache changes often, and enumerator needs to reflect the data as it existed at a specific point in time.
/// </summary>
public class STATURLEnumerator
{
IEnumSTATURL enumrator;
int index;
STATURL staturl;

/// <summary>
/// Constructor for <c>STATURLEnumerator</c> that accepts IEnumSTATURL object that represents the <c>IEnumSTATURL</c> COM Interface.
/// </summary>
/// <param name="enumrator">the <c>IEnumSTATURL</c> COM Interface</param>
public STATURLEnumerator(IEnumSTATURL enumrator)
{
this.enumrator = enumrator;
}
//Advances the enumerator to the next item of the url history cache.
/// <summary>
/// Advances the enumerator to the next item of the url history cache.
/// </summary>
/// <returns>true if the enumerator was successfully advanced to the next element;
/// false if the enumerator has passed the end of the url history cache.
/// </returns>
public bool MoveNext()
{
staturl = new STATURL();
try
{
enumrator.Next(1, ref staturl, out index);
}
catch
{ }
if (index == 0)
return false;
else
return true;
}

/// <summary>
/// Gets the current item in the url history cache.
/// </summary>
public STATURL Current
{
get
{
return staturl;
}
}

/// <summary>
/// Skips a specified number of Call objects in the enumeration sequence. does not work!
/// </summary>
/// <param name="celt"></param>
public void Skip(int celt)
{
enumrator.Skip(celt);
}
/// <summary>
/// Resets the enumerator interface so that it begins enumerating at the beginning of the history.
/// </summary>
public void Reset()
{
enumrator.Reset();
}


public STATURLEnumerator Clone()
{
IEnumSTATURL ppenum;
enumrator.Clone(out ppenum);
return new STATURLEnumerator(ppenum);

}

public void SetFilter(string poszFilter, STATURLFLAGS dwFlags)
{
enumrator.SetFilter(poszFilter, dwFlags);
}

public void GetUrlHistory(IList list)
{

while (true)
{
staturl = new STATURL();
enumrator.Next(1, ref staturl, out index);
if (index == 0)
break;
list.Add(staturl);

}
enumrator.Reset();

}

}

}

}
ericzhangbo1982111 2008-07-10
  • 打赏
  • 举报
回复
using System;
using System.Runtime.InteropServices;
using System.Collections;

namespace UrlHistoryLibrary
{
public struct FILETIME
{
// Summary:
// Specifies the high 32 bits of the FILETIME.
public int dwHighDateTime;
//
// Summary:
// Specifies the low 32 bits of the FILETIME.
public int dwLowDateTime;
}

/// <summary>
/// Used by QueryUrl method
/// </summary>
public enum STATURL_QUERYFLAGS : uint
{
/// <summary>
/// The specified URL is in the content cache.
/// </summary>
STATURL_QUERYFLAG_ISCACHED = 0x00010000,
/// <summary>
/// Space for the URL is not allocated when querying for STATURL.
/// </summary>
STATURL_QUERYFLAG_NOURL = 0x00020000,

STATURL_QUERYFLAG_NOTITLE = 0x00040000,

STATURL_QUERYFLAG_TOPLEVEL = 0x00080000,

}
/// <summary>
/// Flag on the dwFlags parameter of the STATURL structure, used by the SetFilter method.
/// </summary>
public enum STATURLFLAGS : uint
{
/// <summary>
/// Flag on the dwFlags parameter of the STATURL structure indicating that the item is in the cache.
/// </summary>
STATURLFLAG_ISCACHED = 0x00000001,
/// <summary>
/// Flag on the dwFlags parameter of the STATURL structure indicating that the item is a top-level item.
/// </summary>
STATURLFLAG_ISTOPLEVEL = 0x00000002,
}
/// <summary>
/// Used bu the AddHistoryEntry method.
/// </summary>
public enum ADDURL_FLAG : uint
{
/// <summary>
/// Write to both the visited links and the dated containers.
/// </summary>
ADDURL_ADDTOHISTORYANDCACHE = 0,
/// <summary>
/// Write to only the visited links container.
/// </summary>
ADDURL_ADDTOCACHE = 1
}


/// <summary>
/// The structure that contains statistics about a URL.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct STATURL
{
/// <summary>
/// Struct size
/// </summary>
public int cbSize;
/// <summary>
/// URL
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string pwcsUrl;
/// <summary>
/// Page title
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string pwcsTitle;
/// <summary>
/// Last visited date (UTC)
/// </summary>
public FILETIME ftLastVisited;
/// <summary>
/// Last updated date (UTC)
/// </summary>
public FILETIME ftLastUpdated;
/// <summary>
/// The expiry date of the Web page's content (UTC)
/// </summary>
public FILETIME ftExpires;
/// <summary>
/// Flags. STATURLFLAGS Enumaration.
/// </summary>
public STATURLFLAGS dwFlags;

/// <summary>
/// sets a column header in the DataGrid control. This property is not needed if you do not use it.
/// </summary>
public string URL
{
get { return pwcsUrl; }
}
/// <summary>
/// sets a column header in the DataGrid control. This property is not needed if you do not use it.
/// </summary>
public string Title
{
get
{
if (pwcsUrl.StartsWith("file:"))
return Win32api.CannonializeURL(pwcsUrl, Win32api.shlwapi_URL.URL_UNESCAPE).Substring(8).Replace('/', '\\');
else
return pwcsTitle;
}
}
/// <summary>
/// sets a column header in the DataGrid control. This property is not needed if you do not use it.
/// </summary>
public DateTime LastVisited
{
get
{
return Win32api.FileTimeToDateTime(ftLastVisited).ToLocalTime();
}
}
/// <summary>
/// sets a column header in the DataGrid control. This property is not needed if you do not use it.
/// </summary>
public DateTime LastUpdated
{
get
{
return Win32api.FileTimeToDateTime(ftLastUpdated).ToLocalTime();
}
}
/// <summary>
/// sets a column header in the DataGrid control. This property is not needed if you do not use it.
/// </summary>
public DateTime Expires
{
get
{
try
{
return Win32api.FileTimeToDateTime(ftExpires).ToLocalTime();
}
catch (Exception)
{
return DateTime.Now;
}
}
}

}

[StructLayout(LayoutKind.Sequential)]
public struct UUID
{
public int Data1;
public short Data2;
public short Data3;
public byte[] Data4;
}

//Enumerates the cached URLs
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("3C374A42-BAE4-11CF-BF7D-00AA006946EE")]
public interface IEnumSTATURL
{
void Next(int celt, ref STATURL rgelt, out int pceltFetched); //Returns the next \"celt\" URLS from the cache
void Skip(int celt); //Skips the next \"celt\" URLS from the cache. doed not work.
void Reset(); //Resets the enumeration
void Clone(out IEnumSTATURL ppenum); //Clones this object
void SetFilter([MarshalAs(UnmanagedType.LPWStr)] string poszFilter, STATURLFLAGS dwFlags); //Sets the enumeration filter

}


[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("3C374A41-BAE4-11CF-BF7D-00AA006946EE")]
public interface IUrlHistoryStg
{
void AddUrl(string pocsUrl, string pocsTitle, ADDURL_FLAG dwFlags); //Adds a new history entry
void DeleteUrl(string pocsUrl, int dwFlags); //Deletes an entry by its URL. does not work!
void QueryUrl([MarshalAs(UnmanagedType.LPWStr)] string pocsUrl, STATURL_QUERYFLAGS dwFlags, ref STATURL lpSTATURL); //Returns a STATURL for a given URL
void BindToObject([In] string pocsUrl, [In] UUID riid, IntPtr ppvOut); //Binds to an object. does not work!
object EnumUrls { [return: MarshalAs(UnmanagedType.IUnknown)] get;} //Returns an enumerator for URLs


}

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("AFA0DC11-C313-11D0-831A-00C04FD5AE38")]
public interface IUrlHistoryStg2 : IUrlHistoryStg
{
new void AddUrl(string pocsUrl, string pocsTitle, ADDURL_FLAG dwFlags); //Adds a new history entry
new void DeleteUrl(string pocsUrl, int dwFlags); //Deletes an entry by its URL. does not work!
new void QueryUrl([MarshalAs(UnmanagedType.LPWStr)] string pocsUrl, STATURL_QUERYFLAGS dwFlags, ref STATURL lpSTATURL); //Returns a STATURL for a given URL
new void BindToObject([In] string pocsUrl, [In] UUID riid, IntPtr ppvOut); //Binds to an object. does not work!
new object EnumUrls { [return: MarshalAs(UnmanagedType.IUnknown)] get;} //Returns an enumerator for URLs

void AddUrlAndNotify(string pocsUrl, string pocsTitle, int dwFlags, int fWriteHistory, object poctNotify, object punkISFolder);//does not work!
void ClearHistory(); //Removes all history items


}

//UrlHistory class
[ComImport]
[Guid("3C374A40-BAE4-11CF-BF7D-00AA006946EE")]
public class UrlHistoryClass
{

}


}
Joe_Stone 2008-07-10
  • 打赏
  • 举报
回复
你可以用360卫士清除.
nashina 2008-07-10
  • 打赏
  • 举报
回复
要在软件里实现吗
ericzhangbo1982111 2008-07-10
  • 打赏
  • 举报
回复

[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstUrlCacheEntry([MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern, IntPtr lpFirstCacheEntryInfo, ref int lpdwFirstCacheEntryInfoBufferSize);

[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextUrlCacheEntry(IntPtr hEnumHandle, IntPtr lpNextCacheEntryInfo, ref int lpdwNextCacheEntryInfoBufferSize);

[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindCloseUrlCache(IntPtr hEnumHandle);

[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteUrlCacheEntry([MarshalAs(UnmanagedType.LPTStr)] string lpszUrlFileName);

halk 2008-07-10
  • 打赏
  • 举报
回复
你想怎么删?在程序里写代码删?

如果只是想删除这些文件的话,那么重启动到安全模式,然后到这个文件夹全部删除便可。
IE 助手是用Visual C++编写的一个能够随Internet Explorer自行启动的插件,它具有以下功能: 1.广告窗口拦截功能 IE 助手会尽可能拦截所有广告窗口,并自动把这些窗口的URL地址加入 到黑名单中,黑名单地址弹出窗口会自动关闭。误关闭的窗口再次点击链 接就会打开该窗口,并把它加入到白名单中,下一次访问该地址,该窗口 会自动打开。点击链接时按下Shift或者Ctrl 可以用于强制打开一个弹出 窗口。 对于弹出的窗口可以从鼠标右击菜单中选择“加入到黑名单”命令,关 闭该窗口,同时该窗口的地址会被加入到禁止名单,以后用户就再也见不 到该窗口了。除非用户禁止使用IE助手,或者把它从禁止名单中去除。对 于弹出的Flash窗口区域用户可能无法弹出右击菜单,用户可以通过右键点 击页面下边或者页面右边的空白区域弹出右击菜单。 黑名单和白名单中记录可以相互转换,通过转换用户可以自由控制该窗口 是否自动弹出或者关闭。禁止名单中记录除非删除,否则该地址禁止访问, 按下Shift或者Ctrl无效。维护名单时,可以先选中这些记录,然后按下Del键 进行删除。 弹出窗口关闭时有声音提示,用户可以自由定制提示音,也可以使用MIDI或者WAV 文件,为了不影响他人,用户也可以关闭声音提示。 2.IE图换肤 允许用户为IE选择一个位图,用于工具栏、菜单栏、地址栏工具条的图, 设置完毕下次启动IE方能生效。如果用户在选择位图时选择取消,那么将 取消对IE工具条的图换肤。 3.IE修复 能够自动修复主页、起始页、空白页、搜索页被改,恢复正常的桌面图标、 开始菜单,去除开机自动打开浏览器。去除网页对右击菜单的限制和修改,去除 网页对注册表禁用,去除对驱动器图标的隐藏。去除开机自动弹出提示窗口。 能够维护IE的右击菜单和工具菜单项以及工具栏按钮。维护通过注册表实现 自动运行程序。能够重置IE原始配置。 4.IE防火墙 能够拦截恶意网页对注册表的修改,使得恶意网页对注册表的修改无效,注册表 数据只能读不能写。能够自动摘除网页中恶意代码,防止恶意代码读写文件系统, 加载Shell程序。 设置IE属性时必须关闭防火墙或者禁用IE Assistant,否则也无法设置保存IE属性。 为了方便用户使用时,可以通过IE Assistant中的内置的“IE内置属性...”进行设置. 这时设置的结果能够保存.这项功能旨在保护用户的注册表不被修改. 5.注册表的备份和恢复 IE 助手能够在每天第一次启动IE的时候部分备份您的注册表,备份文件大约80KB       左右,下一次启动不再备份。备份文件之能保存7份,七天以前的备份文件会被自动删除。       备份文件可以通过双击导入到注册表中,它可以恢复部分的注册表修改情况(比如主页被改)。       但不一定会解决所有的问题。使用时要把上面3个的功能结合起来使用更好一些。 6.手机短信 IE 助手允许用户发送免费或者收费的手机短信,对于免费免注册手机短信,用户不需       要任何注册,只需要对方手机号码即可发送,没有手机的用户也可以使用。 闪烁功能只对诺基亚手机有效,免提短信仅适用于部分网站。各个网站对发送短信的字数       有限制,所以程序对超长短信进行了处理,把短信分割成几部分多次发送。 7.Web寻呼 IE 助手仅支持国信中文寻呼,没有传呼机照样发免费中文传呼。不需要传呼小姐传话,发送更方便。 8.上网记录清除 IE 助手能够清除上网和用机记录,包括网页记录的密码、Cookie、 IE缓存、网页表单中键入的历史数据(比如Google检索的关键词)、QQ聊天天纪录、开机登录信 息、查找文件和计算机用户信息、使用Office应用程序、RealPlayer、MediaPlayer等 工具留下的记录。清空回收站、临时文件夹,清除NT日志。 9.在线翻译 通过网页右击菜单实现当前网页的英汉互译。 10.在线翻译 通过网页右击菜单实现当前网页的英汉互译。 11.国际传真    允许用户借用网络发送免费国际传真,提供支持国际和地区列表。发送传真就像发送邮件一样容易 12.浏览选项   去除网页对鼠标右键的限制,打开被网页禁止的右键菜单。   禁止网页修改注册表数据,保护注册表不被修改。   记录用户网页提交数据,实现表单数据项的自动填充   对网页中的事件进行处理。   对网络实名进行增强,可以实现在地址栏输入实名后直接进入实名标识的网站,实名查找数据分别来自3721、百度搜索以及CNNIC网络中心。但没有找到实名时会采用用户定义的搜索引擎进行搜索。IE助手允许用户定义自己的实名。             同时它还会把访问过的实名记录到一个XML文件中。下次键入该实名时将不再向上面的三个实名提供商查询,直接检索该文件,把网址定向到查询的结果。该文件可以使用NOTEPAD.exe用UTF8格式打开。   对网页中出现的关键词,用户可以先把它选中,然后右击鼠标,从弹出的菜单中选择          Search KeyWord,将先使用实名查询,找到则跳找到对应的网站,如果没有找到,则使用选定的搜索引擎查询。   13.填表助手   通过拖放操作实现填表,填表项目可以实现即时修改即时生              效,项目内容完全由用户定制。填表项目可以加入到右击菜单中,实现编辑框的的快速填充。   14.网页另存   直接点击右键菜单中的另存为可以快速实现网页的保存。如果选中文本点击“另存为”菜单项,则可以把选中文本快速保存到一个文本文件中.  15.网页阅读   能够以中英文方式阅读网页选中文本和剪板中的内容.

110,023

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧