I've only used a couple of the WinINet functions before, but I found a page on msdn that gives an example of GetUrlCacheEntryInfo(and other cache functions)
And I went ahead and tried it out myself. This seems to work alright for me:
Code:
LPINTERNET_CACHE_ENTRY_INFO cei;
DWORD dwSize = 0;
if(!GetUrlCacheEntryInfo("http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp",NULL,&dwSize))
{
if(GetLastError()==ERROR_INSUFFICIENT_BUFFER)
{
//just need to allocate correct buffer size
cei = (LPINTERNET_CACHE_ENTRY_INFO)new char[dwSize];
cei->dwStructSize = dwSize;
//try again
if(!GetUrlCacheEntryInfo("http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp",cei,&dwSize))
MessageBox(NULL,"Could not retrieve cache entry info","Error",MB_OK);//handle error
else //if successful, print out filename
MessageBox(NULL,cei->lpszLocalFileName,"Cache entry file:",MB_OK);
}
else
MessageBox(NULL,"Could not retrieve cache entry info","Error",MB_OK);//handle error
}