读书人

怎么删除IE的某些历史记录?用VC实现

发布时间: 2012-02-11 09:51:35 作者: rapoo

如何删除IE的某些历史记录?用VC实现
最好能给些实例代码,我想这么简单的事情就不要用MFC了

[解决办法]
#include <shlguid.h> // Needed for CLSID_CUrlHistory
#include <urlhist.h> // Needed for IUrlHistoryStg2 and ID_IUrlHistoryStg2
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();

读书人网 >VC/MFC

热点推荐