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