views:

1681

answers:

3

Hi,

I was using the following script to delete the browsing history in IE 7.0

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

But now I need a script to clear browsing history in IE 6.0

I get an error that "missing entry ClearMyTracksByProcess" I have passed different parameters like 2 ,5 etc and wasn't successful.

+1  A: 
VonC
A: 

ClearMyTracks() was not part of IE6, so you cannot do the same trick.

If you just want to clear history, you can write a small program that just CoCreates(CLSID_CUrlHistory, IID_IUrlHistoryStg2) and then call IUrlHistoryStg::ClearHistory().

Should be able to do it from VBScript as well, but I don't know the right mojo.

jeffamaphone
A: 
// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "test.h"
#include <shlguid.h> // Needed for CLSID_CUrlHistory
#include <urlhist.h> // Needed for IUrlHistoryStg2 and IID_IUrlHistoryStg2

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// The one and only application object

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    int nRetCode = 0;

    // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
     // TODO: change error code to suit your needs
     _tprintf(_T("Fatal Error: MFC initialization failed\n"));
     nRetCode = 1;
    }
    else
    {
     // TODO: code your application's behavior here.

     IUrlHistoryStg2* pHistory;  // We need this interface for clearing the history.
        HRESULT hr;
        DWORD cRef;
        CoInitialize(NULL);
        // Load the correct Class and request IUrlHistoryStg2
        hr = CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_INPROC_SERVER,
     IID_IUrlHistoryStg2, reinterpret_cast<void **>(&pHistory));

     if (SUCCEEDED(hr))
        {
         // Clear the IE History
         hr = pHistory->ClearHistory();
        }
        // Release our reference to the 
        cRef = pHistory->Release();
        CoUninitialize();
    }

    return nRetCode;
}