代碼: 選擇全部
#include "urlhist.h"
#include "objbase.h"
#include "shlguid.h"
void __fastcall Tform1::Button1Click(TObject *Sender)
{
HRESULT hr=S_FALSE;
IUrlHistoryStg2* pUrlHistoryStg2=NULL;
CoInitialize(NULL);
hr=CoCreateInstance(CLSID_CUrlHistory, NULL, CLSCTX_INPROC,
IID_IUrlHistoryStg2, (void**)&pUrlHistoryStg2);
if(SUCCEEDED(hr))
{
hr=pUrlHistoryStg2->ClearHistory();
if(SUCCEEDED(hr))
{
ShowMessage("Clear IE History succeeded!");
}
else
{
ShowMessage("Clear IE History failed!");
}
pUrlHistoryStg2->Release();
}
CoUninitialize();
}