如何获取(清除)IE缓存地址信息
来源:互联网 发布:财新网数据新闻 编辑:程序博客网 时间:2024/05/22 03:41
一、主要用到以下几个API:
1、FindFirstUrlCacheEntry
2、FindNextUrlCacheEntry
3、FindCloseUrlCache
下面的内容摘自MSDN:
-------------------------------------------------------------------------------------------------------------------------------------------------------
FindCloseUrlCache
This function closes the specified cache enumeration handle.
BOOL FindCloseUrlCache( HANDLE hEnumHandle );
Parameters
hEnumHandle
[in] Handle returned by a previous call to the FindFirstUrlCacheEntry function.
Return Values
Returns TRUE if successful, or FALSE otherwise.
Requirements
OS Versions: Windows CE 2.12 and later.
Header: Wininet.h.
Link Library: Wininet.lib.
DeleteUrlCacheEntry
This function removes the file associated with the source name from the cache, if the file exists.
BOOL DeleteUrlCacheEntry( LPCTSTR lpszUrlName );
Parameters
lpszUrlName
[in] Address of a string variable that contains the cache entry source name. The name string must be unique and cannot contain escape characters.
Return Values
Returns TRUE if successful, or FALSE otherwise.
Requirements
OS Versions: Windows CE 2.12 and later.
Header: Wininet.h.
Link Library: Wininet.lib.
DWORD dwStructSize;
LPTSTR lpszSourceUrlName;
LPTSTR lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpireTime;
FILETIME LastAccessTime;
FILETIME LastSyncTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPTSTR lpszFileExtension;
union {
DWORD dwReserved;
DWORD dwExemptDelta;
}; } INTERNET_CACHE_ENTRY_INFO,
*LPINTERNET_CACHE_ENTRY_INFO;
#include <windows.h>
#include <wininet.h>
//获取IE上网缓存信息。如Cookie信息、Visited网址信息等
BOOL GetIECache()
{
int count = 0;
HANDLE hCacheEnumHandle = NULL;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry = NULL;
DWORD dwSize = 4096;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwSize];
lpCacheEntry->dwStructSize = dwSize;
// URL search pattern (1st parameter) options are: NULL ("*.*"), "cookie:",
// or "visited:".
hCacheEnumHandle = FindFirstUrlCacheEntry(
"visited:", lpCacheEntry, &dwSize);
if(hCacheEnumHandle != NULL)
{
printf(" %s ", lpCacheEntry->lpszSourceUrlName);
}
else
{
switch(GetLastError())
{
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwSize];
lpCacheEntry->dwStructSize = dwSize;
// Repeat first step search with adjusted buffer, exit if not
// found again (in practice one buffer's size adustment is
// always OK).
hCacheEnumHandle = FindFirstUrlCacheEntry("visited:", lpCacheEntry,
&dwSize);
if (hCacheEnumHandle != NULL)
{
count++;
printf(" %d: %s ", count, lpCacheEntry->lpszSourceUrlName);
break;
}
else
{
// FindFirstUrlCacheEntry fails again, return.
return FALSE;
}
default:
{
FindCloseUrlCache(hCacheEnumHandle);
return FALSE;
}
}
}
do
{
// Notice that return values of FindNextUrlCacheEntry (BOOL) and
// FindFirstUrlCacheEntry (HANDLE) are different.
if (FindNextUrlCacheEntry(hCacheEnumHandle, lpCacheEntry, &dwSize))
{
count++;
printf(" %d: %s ", count, lpCacheEntry->lpszSourceUrlName);
}
else
{
switch(GetLastError())
{
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry =
(LPINTERNET_CACHE_ENTRY_INFO) new char[dwSize];
lpCacheEntry->dwStructSize = dwSize;
// Repeat next step search with adjusted buffer, exit if
// error comes up again ((in practice one buffer's size
// adustment is always OK).
if (FindNextUrlCacheEntry(hCacheEnumHandle, lpCacheEntry,
&dwSize))
{
count++;
printf(" %d: %s ", count, lpCacheEntry->lpszSourceUrlName);
break;
}
else
{
// FindFirstUrlCacheEntry fails again, return.
FindCloseUrlCache(hCacheEnumHandle);
return FALSE;
}
break;
case ERROR_NO_MORE_ITEMS:
FindCloseUrlCache(hCacheEnumHandle);
return TRUE;
default:
FindCloseUrlCache(hCacheEnumHandle);
return FALSE;
}
}
} while (TRUE);
}
- 如何获取(清除)IE缓存地址信息
- 如何获取(清除)IE缓存地址信息
- 如何编程清除IE缓存
- 如何编程清除IE缓存
- [IE编程] 如何编程清除IE缓存
- 如何编程清除IE缓存收藏
- 如何获取与清除IE历史记录
- 如何获取与清除IE历史记录
- VB清除IE缓存
- JS 清除IE缓存
- Javascript清除IE缓存
- c# 清除IE缓存
- 清除IE缓存
- 清除IE缓存
- JS 清除IE缓存
- 清除IE缓存BAT
- sdwebimage如何获取缓存大小以及清除缓存
- sdwebimage如何获取缓存大小以及清除缓存
- 深入理解gtest C/C++单元测试经验谈
- java删除一个文件
- 原型模式
- SQL Server 开发之 复制表数据的SQL脚本生成器
- 移动互联网一周(2012.2.6-2012.2.12)大事记
- 如何获取(清除)IE缓存地址信息
- VB工程-- 百例79--字体屏保
- java二维数组
- 如何获取与清除IE历史记录
- 作业2
- 添加DOS命令(CMD控制台)到文件夹右键菜单
- 设置不同事件View背景颜色
- 文件传输协议(FTP)必将消亡
- JS , CSS ,image HTML DOM的加载过程 以及 总结JS的基本用法