首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

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

2012-02-11 
如何删除IE的某些历史记录?用VC实现最好能给些实例代码,我想这么简单的事情就不要用MFC了[解决办法]#inclu

如何删除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();

热点排行