最近要保存网页为mht文件,准备自己写,不用CDO对象,也不用IE接口。其中要读IE缓存中的文件,找到如下方法:
#include <wininet.h>
DWORD dwEntrySize = 0;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry;
LPCTSTR IMG_PATH=_T("http://zi.csdn.net/csdn-homepage-760-90-20k.gif");
if (!GetUrlCacheEntryInfo( IMG_PATH, NULL, &dwEntrySize))
{
if (GetLastError()!=ERROR_INSUFFICIENT_BUFFER)
return;
else
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)new BYTE[dwEntrySize];
if (GetUrlCacheEntryInfo( IMG_PATH,lpCacheEntry, &dwEntrySize))
{
{
::CopyFile( lpCacheEntry->lpszLocalFileName
, _T("c://out.gif")
, FALSE
);
}
}
delete lpCacheEntry;
}