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;
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