获取IE历史记录

来源:互联网 发布:人物描写 知乎 编辑:程序博客网 时间:2024/05/17 03:07
#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;   } 

原创粉丝点击