Click here to Skip to main content
Licence CPOL
First Posted 18 Jul 2006
Views 20,005
Downloads 384
Bookmarked 20 times

Web Sweeper - Leave No Trace

By | 4 Aug 2006 | Article
Internet History Cleaning App
Sample screenshot

Introduction

This is my first post, ever, so bear with me. This program is the fulfillment of many an hour of lazy work, and was my brother's idea since I have no imagination. When I started, I wanted to develop an application that would clean up the mess that Internet Explorer leaves behind, keeping my computer running smoothly, etc. It can't be any simpler than this, all you have to do is press the "Sweep!" button, and it deletes the current users Temporary Internet Files, clears the history, and even goes into the registry and deletes the "TypedUrls" folder, cleaning up the address bar clutter.

Using the Code

Firstly, I haven't tested this code with Firefox, nor have I tried it on all operating systems, so just go with it and if you try it on an OS other than Windows XP Home or Windows 98 SE, leave me a message and tell me how it worked. To clear the history, I borrowed some code (no copyright notifications), it's simple but does the job great. To use, all you need to do is copy and paste in these includes and then the code:

#include <urlhist.h>
#include <Wininet.h>
#include <shlobj.h>
#include <shlguid.h>
#include <shlwapi.h>
CoInitialize(NULL);

  IUrlHistoryStg2* pUrlHistoryStg2 = NULL; 

  HRESULT hr = CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_INPROC,
  
  IID_IUrlHistoryStg2, (void**)&pUrlHistoryStg2);

  if (SUCCEEDED(hr))
  {
       hr = pUrlHistoryStg2->ClearHistory(); 

        if (!(SUCCEEDED(hr)))
            goto cleanup;

      pUrlHistoryStg2->Release();

      done++;
  }

Skipping some of the more gritty details (you can download the source code, you know), I'd like to jump to the hardest function for me to make, maybe since I was too lazy, but going through my registry trying to find one folder is hard stuff. It's the function that deletes the "TypedUrls" folder in "HKEY_USERS\\Software\\Microsoft\\Internet Explorer\\TypedURLs":

sKey.Empty();
         
sKey += szSid; 	//szSid is a unique number identifier, the number 
                 	// is computed with a helper function "GetSidString"

sKey += \\Software\\Microsoft\\Internet Explorer\\TypedURLs;

        RegSetPrivilege(HKEY_USERS, sKey, &NewSD, TRUE);
        SHDeleteKey(HKEY_USERS, sKey); 

Something to be aware of, using my compiler, which is Microsoft Visual Studio 6.0 C++, it generates 2 warnings. There is nothing wrong with the program and it works just fine, but it still comes up with them as "possible loss of data". Just forget about them, unless you can find a way to improve the program, in which case by all means leave me a comment or send me an email.

History

  • 1.0 - Initial release
  • 2.1 - Added functionality, including clearing the "Temporary Internet Files" folder and a Progress Bar to Show the Progress of the Application, and Fixed a bug that didn't clear the history on computers running Windows 98
  • 2.2 - Now clears the 'Temp' folder in the 'Local Settings' Folder, however it doesn't clear all of the files
  • 2.4 - Added progress bar again after problems, improved functionality, works great
  • 2.4b - Added read-only text box to tell how many files were detected, and the files that aren't deleted are protected files or the "index.dat"
  • 2.5 - Finally fixed bug where all the autocomplete forms wouldn't clear
  • 2.6 - Added a timer to tell the user how long the sweep took

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Canopener4000

Web Developer

United States United States

Member

Born in California
Living in California
Been programming C++ for nearly 5 years, thank you dad.
 
Lately, im been put in charge of a web site. Its easy enough, since i know nothing about em, but hey what can you do. And its just for school and i kept it simple since i know almost nothing about web programming(Thank you dreamweaver!!!!!)
 

Other interests - When im not screwing around with C++, i like to play video games, and who doesnt like doing that, and, well, i dont know what else.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow to block the IE generate temporary files? PinmemberXuefei.Wu16:57 13 Apr '09  
Question'Bare' with you? Pinmemberconixsdh3:33 19 Jul '06  
AnswerRe: 'Bare' with you? PinmemberCanopener400011:35 19 Jul '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 4 Aug 2006
Article Copyright 2006 by Canopener4000
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid