判断IE的缓冲文件存储的位置并取得该文件
2005-03-17 02:29
399 查看
将Wininet.lib加到工程里去
int WINAPI EnumerateCacheOld(HWND hX)
{
DWORD dwEntrySize;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry;
DWORD MAX_CACHE_ENTRY_INFO_SIZE=4096;
HANDLE hCacheDir;
int nCount=0;
SendDlgItemMessage(hX,IDC_CacheList,LB_RESETCONTENT,0,0);
SetCursor(LoadCursor(NULL,IDC_WAIT));
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
again:
if (!(hCacheDir = FindFirstUrlCacheEntry(NULL,lpCacheEntry,&dwEntrySize)))
{
delete[]lpCacheEntry;
switch(GetLastError())
{
case ERROR_NO_MORE_ITEMS:
char tempout[80];
sprintf(tempout,"The number of cache entries = %d /n",nCount);
MessageBox(hX,tempout,"Cache Enumeration",MB_OK);
FindCloseUrlCache(hCacheDir);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return TRUE;
break;
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)
new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
goto again;
break;
default:
ErrorOut(hX,GetLastError(),"FindNextUrlCacheEntry Init");
FindCloseUrlCache(hCacheDir);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return FALSE;
}
}
SendDlgItemMessage(hX,IDC_CacheList,LB_ADDSTRING,
0,(LPARAM)(lpCacheEntry->lpszSourceUrlName));
nCount++;
delete (lpCacheEntry);
do
{
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
retry:
if (!FindNextUrlCacheEntry(hCacheDir,lpCacheEntry, &dwEntrySize))
{
delete[]lpCacheEntry;
switch(GetLastError())
{
case ERROR_NO_MORE_ITEMS:
char tempout[80];
sprintf(tempout,"The number of cache entries =
%d /n",nCount);
MessageBox(hX,tempout,"Cache Enumeration",MB_OK);
FindCloseUrlCache(hCacheDir);
return TRUE;
break;
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)
new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
goto retry;
break;
default:
ErrorOut(hX,GetLastError(),"FindNextUrlCacheEntry Init");
FindCloseUrlCache(hCacheDir);
return FALSE;
}
}
SendDlgItemMessage(hX,IDC_CacheList,LB_ADDSTRING,
0,(LPARAM)(lpCacheEntry->lpszSourceUrlName));
nCount++;
delete[] lpCacheEntry;
}
while (TRUE);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return TRUE;
}
int WINAPI EnumerateCacheOld(HWND hX)
{
DWORD dwEntrySize;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry;
DWORD MAX_CACHE_ENTRY_INFO_SIZE=4096;
HANDLE hCacheDir;
int nCount=0;
SendDlgItemMessage(hX,IDC_CacheList,LB_RESETCONTENT,0,0);
SetCursor(LoadCursor(NULL,IDC_WAIT));
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
again:
if (!(hCacheDir = FindFirstUrlCacheEntry(NULL,lpCacheEntry,&dwEntrySize)))
{
delete[]lpCacheEntry;
switch(GetLastError())
{
case ERROR_NO_MORE_ITEMS:
char tempout[80];
sprintf(tempout,"The number of cache entries = %d /n",nCount);
MessageBox(hX,tempout,"Cache Enumeration",MB_OK);
FindCloseUrlCache(hCacheDir);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return TRUE;
break;
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)
new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
goto again;
break;
default:
ErrorOut(hX,GetLastError(),"FindNextUrlCacheEntry Init");
FindCloseUrlCache(hCacheDir);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return FALSE;
}
}
SendDlgItemMessage(hX,IDC_CacheList,LB_ADDSTRING,
0,(LPARAM)(lpCacheEntry->lpszSourceUrlName));
nCount++;
delete (lpCacheEntry);
do
{
dwEntrySize = MAX_CACHE_ENTRY_INFO_SIZE;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
retry:
if (!FindNextUrlCacheEntry(hCacheDir,lpCacheEntry, &dwEntrySize))
{
delete[]lpCacheEntry;
switch(GetLastError())
{
case ERROR_NO_MORE_ITEMS:
char tempout[80];
sprintf(tempout,"The number of cache entries =
%d /n",nCount);
MessageBox(hX,tempout,"Cache Enumeration",MB_OK);
FindCloseUrlCache(hCacheDir);
return TRUE;
break;
case ERROR_INSUFFICIENT_BUFFER:
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)
new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
goto retry;
break;
default:
ErrorOut(hX,GetLastError(),"FindNextUrlCacheEntry Init");
FindCloseUrlCache(hCacheDir);
return FALSE;
}
}
SendDlgItemMessage(hX,IDC_CacheList,LB_ADDSTRING,
0,(LPARAM)(lpCacheEntry->lpszSourceUrlName));
nCount++;
delete[] lpCacheEntry;
}
while (TRUE);
SetCursor(LoadCursor(NULL,IDC_ARROW));
return TRUE;
}
相关文章推荐
- 根据URI取得文件的存储位置
- 设置Hadoop+Hbase集群pid文件存储位置
- docker - 修改镜像/容器文件或者 "Docker root dir" 的在宿主机上的存储位置
- Android 判断系统默认存储位置是“内置存储卡”还是“SD卡”
- 怎么修改Outlook2010 PST数据文件位置(默认邮件存储目录)
- Outlook 2003中各个数据存储和配置文件的存放位置
- FM app在保存录音文件时,保存的位置如何实现跟随默认存储位置的改变而改变?
- android 入门学习笔记 取得文件架构、打开文件、判断文件MimeType 的方法
- android文件存储位置切换
- RAC使用共享存储,使用数据泵导入时,数据文件存放位置查询
- 详述查看 MySQL 数据文件存储位置的方法
- MySQL 5.7 修改数据库文件存储位置
- ubuntu trash 垃圾箱的文件存储位置
- 设置Hadoop+Hbase集群pid文件存储位置
- Ie 和 Firefox 下取得textarea 和 input.text的光标位置
- Android仿电脑端选择文件存储位置实例
- Android文件存储位置简述
- 模拟器可以直接把Mac 的桌面文件做为iOS调试时存储的位置
- 判断文件存储是否支持某种视图
- Android中的文件存储位置分析