Now i Found a good code

Giganews Newsgroups
Subject: Now i Found a good code
Posted by:  //---- Kelsie.Z.Marshall [at gmail] (kelsie.z.marsha…@gmail.com)
Date: Sun, 20 Sep 2009

//bool __fastcall DelTempAFilesAndCookiesFromIE(void);

bool __fastcall TFormMain::DelTempAFilesAndCookiesFromIE(void)
{
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)
  {
  //---- We 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);

                    if (bSuccess)
                    {
                      dwError = ERROR_SUCCESS;
                    }
                    else
                    {
                      dwError = GetLastError();
                      dwEntrySize = dwTrySize; // use new size returned
                    }
                  }break;
    //---- We are done
  case ERROR_NO_MORE_ITEMS:      {
                    bDone = TRUE;
                    bResult = TRUE;
                  } break;

    //---- We have got an entry
  case ERROR_SUCCESS:            {
                    // don't delete cookie entry  //if
(!(lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY))
                    if ((lpCacheEntry->CacheEntryType & COOKIE_CACHE_ENTRY))
//---- Delete Cookie
                    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;
  }
  if (bDone)
  {
  delete [] lpCacheEntry;
  if (hCacheDir)
  {
    FindCloseUrlCache(hCacheDir);
  }
  }
} while (!bDone);

return bResult;
}
//---------------------------------------------------------------------------

Every one could made that. Post the final and right code at the end of the
Thread.

Regards

Kelsie

http://sites.google.com/site/cppbuildermaster/

"//---- Kelsie.Z.Marshall [at gmail]" <kelsie.z.marsha…@gmail.com> wrote in
message news:A0479F997A91E340kelsie.z.marsha…@gmail.com...
> There is anyway to make TWebBrowser clean(delete internet tem files,
> including cookies) web history of IE  ? Because TWebBrowser and IE are
> linked from some way.
>
> Kelsie

Replies

None

In response to

TWebBrowser clean Cookies, IE Linked ? posted by //---- Kelsie.Z.Marshall [at gmail] on Sun, 20 Sep 2009