Originally posted by: A programmer from PA
This worked well and compiled error free right away, just be sure to link the wininet.lib library file. I see there is an individual that posted here that needs to learn a few manners. Maybe that poster should focus a little more of those efforts to learning how to actually write code rather than raging at other when they don't understand. It takes time, years to become a good programmer. Frustration and failure are a large part of the process. So to whom ever posted "THIS DOES NOT WORK ASSHOLE!!!!" you may want to be looking into a mirror the next time you yell "Hey Asshole!!!".
Reply
Originally posted by: Narasimha
I appreciate some help.
Thanks,
I tried this code in VC6 on Win2K and it not working. WHile debugging, I observed the following behaviour. I put the watch for the following variables of LPCACHEENTRY struct.
lpszFileName is showing complete filename
lpszSourceUrlName is showing only 'h' instead of showing http://..... So, when I tried DeleteUrlCacheEntry, I am getting FILE NOT FOUND error. But when I see the memory pointed to by lpszSourceUrlName, it is showing complete URL. I couldn't figure out what is going on. Do I need to install some patch?
Narasimha
Originally posted by: SanskyPotov
Mainly it depends where and how you have used this function.
I found out the following facts.
1. The function scans the folder and tries to delete the files.
2. The files are deleted, but if some files are locked by IE
3. The next time an attempt is made to delete the files again,
The solution is
Hope this helps. Any modifications/ enhancements / corrections
Hello,
After going through all the comments and myself experiencing the problem that the solution does not seem.
those files will not be deleted.
only if any new files in the cache will be deleted, the old
files will not be deleted ( even if they are not locked by IE)
To maintain the physical filenames ( the filepath like c:\...\x.htm ) , perhaps in an array if the attempt to delete
the files has failed. On the next function call these files
could be deleted with DeleteFile function.
are welcome.
Reply
Originally posted by: flytaek
oh... thanks.....
well done.... ^^
Originally posted by: Gilad
That is a great thing. I didn't find any documentation for it (as you wrote) in MS site or anywhere else.
Thanks.
Hopefully in the past 4 years user "NYOB" has grown up. Clearly when he posted the infantile comment he was in no fit state to reply let alone do any programming. He can't have known much about VC++, or he would have worked out the code for himself rather than using someone else's skills and effort where his own were so demonstrably deficient. What a total chump.
ReplyOriginally posted by: Sushil
Does anyone have an idea, how can my application get information about latest URL visited by user in IE?
Thanx,
Sushil
Originally posted by: mack
can any one tell me how to view the time when a particular
web site was visited
Originally posted by: Vinod Vishwanath
if (bSuccess)
// we are done
// we have got an entry
// unknown error
if (bDone)
int main()
//Its essentially the same though :-)
#include <windows.h>
#include <wininet.h>
//
// Delete all files in the Temporary Internet Files folder
//
// Note that you can specify what NOT to delete by testing entry type
// In code below, cookie entries are not deleted
// [see if (!(lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY))]
//
BOOL DelTempFiles()
{
BOOL bResult = FALSE;
BOOL bDone = FALSE;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry = NULL;
DWORD dwTrySize, dwEntrySize = 4096; // start buffer size
HANDLE hCacheDir = NULL;
DWORD dwError = ERROR_INSUFFICIENT_BUFFER;
do
{
switch (dwError)
{
// need a bigger buffer
case ERROR_INSUFFICIENT_BUFFER:
delete [] lpCacheEntry;
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO) new char[dwEntrySize];
lpCacheEntry->dwStructSize = dwEntrySize;
dwTrySize = dwEntrySize;
BOOL bSuccess;
if (hCacheDir == NULL)
bSuccess = (hCacheDir
= FindFirstUrlCacheEntry(NULL, lpCacheEntry,
&dwTrySize)) != NULL;
else
bSuccess = FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize);
dwError = ERROR_SUCCESS;
else
{
dwError = GetLastError();
dwEntrySize = dwTrySize; // use new size returned
}
break;
case ERROR_NO_MORE_ITEMS:
bDone = TRUE;
bResult = TRUE;
break;
case ERROR_SUCCESS:
// don't delete cookie entry
if (!(lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY))
DeleteUrlCacheEntry(lpCacheEntry->lpszSourceUrlName);
// get ready for next entry
dwTrySize = dwEntrySize;
if (FindNextUrlCacheEntry(hCacheDir, lpCacheEntry, &dwTrySize))
dwError = ERROR_SUCCESS;
else
{
dwError = GetLastError();
dwEntrySize = dwTrySize; // use new size returned
}
break;
default:
bDone = TRUE;
break;
}
{
delete [] lpCacheEntry;
if (hCacheDir)
FindCloseUrlCache(hCacheDir);
}
} while (!bDone);
return bResult;
}
{
DelTempFiles();
return 0;
}
Originally posted by: Sohail Aslam
Hi There,
Thanks for sharing great piece of code. I made a minor modification and have tested it specifically for deleting cookies and it not only works for Windows NT/98 but on Windows 2000 as well.
Best Regards,
Sohail.
Will it work if you have IE 5.5 and using HTML? Thank you.
ReplyOriginally posted by: celery
how to delete favorites?
thanks!