#include<stdio.h>
#include<windows.h>
#include<UrlHist.h>//IUrlHistoryStg2
#include<shlobj.h>//CLSID_CUrlHistory,SHAddToRecentDocs
#include<atlbase.h>//USES_CONVERSION;
void GetIEHistory()
{
USES_CONVERSION;//Unicode转Ansi用
CoInitialize(NULL);//初始化
IUrlHistoryStg2*pUrlHistoryStg2=NULL;
HRESULT hr=CoCreateInstance(CLSID_CUrlHistory,
NULL,CLSCTX_INPROC,IID_IUrlHistoryStg2,
(void**)&pUrlHistoryStg2);
/**//*if(SUCCEEDED(hr))
{
hr=pUrlHistoryStg2->ClearHistory();
pUrlHistoryStg2->Release();
}*/
IEnumSTATURL*pEnumURL;
hr=pUrlHistoryStg2->EnumUrls(&pEnumURL);
STATURL suURL;
ULONG pceltFetched;
suURL.cbSize=sizeof(suURL);
hr=pEnumURL->Reset();
while((hr=pEnumURL->Next(1,&suURL,&pceltFetched))==S_OK)
{
//hr=pUrlHistoryStg2->DeleteUrl(suURL.pwcsUrl,0);
printf("%ws\n",suURL.pwcsUrl);
}
pEnumURL->Release();
pUrlHistoryStg2->Release();
CoUninitialize();
}
int main( void )
{
GetIEHistory();
return 0;
}
获取IE历史记录
最新推荐文章于 2021-03-11 04:07:00 发布