一、主要用到了COM组件提供的接口实现,几个接口包括:
1、IUrlHistoryStg、IUrlHistoryStg2(IUrlHistoryStg2接口继承自IUrlHistoryStg)
2、IEnumSTATURL
下面接口信息摘自MSDN
IUrlHistoryStg
Interface
This interface manages Microsoft Internet Explorer history for the current user.
IUrlHistoryStg Members
AddUrl |
Places the specified URL into the history. If the URL does not exist in the history, an entry is created in the history. If the URL does exist in the history, it is overwritten. |
BindToObject |
Not currently implemented. |
DeleteUrl |
Deletes all instances of the specified URL from the history. |
EnumUrls |
Returns an interface to an enumerator of the history's visited links. |
QueryUrl |
Queries the history and reports whether the URL passed as thepocsUrlparameter has been visited by the current user. |
InterfaceInformation
Stock Implementation
shdocvw.dll |
Custom Implementation
No |
Inherits from
IUnknown |
Header and IDL files
urlhist.h,urlhist.idl
|
Minimum availability
Internet Explorer 5.5 |
Minimum operating systems
Millennium, Windows2000 |
IUrlHistoryStg2
Interface
This interface provides additional features for managing the user's history.
IUrlHistoryStg2 Members
InterfaceInformation
Stock Implementation
shdocvw.dll |
Custom Implementation
No |
Inherits from
IUrlHistoryStg |
Header and IDL files
urlhist.h,urlhist.idl
|
Minimum availability
Internet Explorer 5.5 |
Minimum operating systems
Millennium, Windows2000 |
IEnumSTATURL
Interface
This interface enumerates the items in the history cache.
IEnumSTATURL Members
Clone |
Not currently implemented. |
Next |
Searches the history for any URL that matches the search pattern and copies it to the specified buffer. |
Reset |
Resets the enumerator interface so that it begins enumerating at the beginning of the history. |
SetFilter |
IEnumSTATURL::Nextcompares the specified URL with each URL in the history list to find matches.IEnumSTATURL::Nextthen
copies the list of matches to a buffer. This method is used to specify the URL to compare. |
Skip |
Not currently implemented. |
InterfaceInformation
Stock Implementation
shdocvw.dll |
Custom Implementation
No |
Inherits from
IUnknown |
Header and IDL files
urlhist.h,urlhist.idl
|
Minimum availability
Internet Explorer 5.5 |
Minimum operating systems
Millennium, Windows2000 |
二、用到的接口中的相关方法:
1、IUrlHistoryStg::EnumUrls
IUrlHistoryStg::EnumUrlsMethod
Returnsaninterfacetoanenumeratorofthehistory'svisitedlinks.
Syntax
HRESULTEnumUrls(IEnumSTATURL**ppEnum);
Parameters
ppEnum:[out]Pointerthatreceivesapointertotheinterfacetoahistoryenumerator.
ReturnValue
ReturnsS_OKifsuccessful,oranerrorvalueotherwise.
2、IEnumSTATURL::Next
LRESULTIEnumSTATURL::Next(ULONGcelt,LPSTATURLrgelt,ULONG*pceltFetched)
参数说明:
celt意义不明,不能为0,可以将其设为1。
Rgelt是STATURL结构指针,该结构由MS-IE填充。
PceltFetched由方法返回,返回1表示rgelt结构被成功填充了。若要用到第二参数内的数据,应该判断该值是否为1。
其中结构STATURL定义如下
STATURLStructure
ContainsstatisticsaboutaURL.ThisstructureisfilledbyMicrosoftInternetExplorerduringcallstoIUrlHistoryStg::QueryUrlandIEnumSTATURL::Next.
Syntax
typedefstruct_STATURL...{
DWORDcbSize;
LPWSTRpwcsUrl;
LPWSTRpwcsTitle;
FILETIMEftLastVisited;
FILETIMEftLastUpdated;
FILETIMEftExpires;
DWORDdwFlags;
}STATURL,*LPSTATURL;
Members
cbSize
DWORDthatshouldbesettosizeof(STATURL).
pwcsUrl
ThespecifiedURL.Thecallingfunctionmustfreethisparameter.SetthisparametertoSTATURL_QUERYFLAG_NOURLifnoURLisspecified.
pwcsTitle
ThetitleoftheWebpage,ascontainedinthetitletags.Thiscallingapplicationmustfreethisparameter.SetthisparametertoSTATURL_QUERYFLAG_NOTITLEifnoWebpageisspecified.
ftLastVisited
Thelasttimetheuservisitedthispage.
ftLastUpdated
Thelasttimethepagewasupdated.
ftExpires
TheexpirydateoftheWebpage'scontent.
dwFlags
DWORDthatcanbeeitherSTATURL_QUERYFLAG_ISCACHEDorSTATURL_QUERYFLAG_TOPLEVEL.
三、代码实现(VC6.0+Windows XP)
#include<stdio.h>
#include<windows.h>
#include<UrlHist.h>//IUrlHistoryStg2
#include<shlobj.h>//CLSID_CUrlHistory,SHAddToRecentDocs
#include<atlbase.h>//USES_CONVERSION;
voidGetIEHistory()
...{
USES_CONVERSION;//Unicode转Ansi用
CoInitialize(NULL);//初始化
IUrlHistoryStg2*pUrlHistoryStg2=NULL;
HRESULThr=CoCreateInstance(CLSID_CUrlHistory,
NULL,CLSCTX_INPROC,IID_IUrlHistoryStg2,
(void**)&pUrlHistoryStg2);
/**//*if(SUCCEEDED(hr))
{
hr=pUrlHistoryStg2->ClearHistory();
pUrlHistoryStg2->Release();
}*/
IEnumSTATURL*pEnumURL;
hr=pUrlHistoryStg2->EnumUrls(&pEnumURL);
STATURLsuURL;
ULONGpceltFetched;
suURL.cbSize=sizeof(suURL);
hr=pEnumURL->Reset();
while((hr=pEnumURL->Next(1,&suURL,&pceltFetched))==S_OK)
...{
//hr=pUrlHistoryStg2->DeleteUrl(suURL.pwcsUrl,0);
printf("%s",W2T(suURL.pwcsUrl));
}
pEnumURL->Release();
pUrlHistoryStg2->Release();
CoUninitialize();
}
分享到:
相关推荐
清除ie历史浏览记录,利用vbs小脚本,其中的参数可以随意调换,8-cookie,16-表单数据,32-密码,2-临时文件,1-历史记录
可以清除IE的历史浏览记录,不想让别人知道你都看了什么吧,马上清除吧
如何彻底清除ie历史记录.docx
ie清除历史记录。
◆一键清除IE历史记录 ◆一键清除IE表单 ◆一键清除IE自动完成->密码 ◆一键清除IE自动完成->地址栏历史记录 ◆一键清除IE存储的FTP帐号 ◆一键清除IE临时文件 ◆一键清除遨游浏览器历史记录 ◆一键清除火狐...
清除ie和计算机地址栏的历史记录清除ie和计算机地址栏的历史记录清除ie和计算机地址栏的历史记录清除ie和计算机地址栏的历史记录清除ie和计算机地址栏的历史记录
Index.dat保存的历史记录:IE历史记录会作为一个副本保存到index.dat文件中,即使在IE中清除历史记录,该部分保存的记录也不能清除。文件路径:C:\Documents and Settings\Administrator\Local Settings\History\...
清理IE浏览器缓存历史记录临时文件
IE恢复器,恢复IE默认设置,清除历史记录…..rar`
MFC 源代码........ 清空IE的历史记录
VB清除Windows系统历史记录,包括各方面的操作记录,比如清除IE临时文件、清除COOKIES、清除历史文件记录、清除画板记录以及搜索记录等。有点360安全卫士中的垃圾清理功能,本清理程序在运行时显示清理进度条,并可...
历史记录管理器用于查看和管理IE上网历史记录、缓存记录、cookie记录、地址栏历史记录...另外,还可以查看并彻底清除使用IE的清除历史记录不能清除的记录。最大限度保护你的隐私。也可以用于监控未成年人对电脑的使用。
清除IE右键菜单 1;通过“开始 -> 运行 -> regedit”进入注册表,来到 HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt”位置,点击文件夹 的“+”号,就可以看到 ,选中不需要的主键,右击...
VB编程实现清除系统历史记录,清除IE的临时文件、COOKIES、历史文档、画板记录和搜索记录等,如果你正在编写一个系统优化软件,那么这款示例程序也许能为你提供一份参考资料。
如何清除Windows Phone中IE的浏览历史记录-.docx
VB编程实现清除系统历史记录,清除IE的临时文件、COOKIES、历史文档、画板记录和搜索记录等,如果你正在编写一个系统优化软件...
一键自动清理IE缓存、删除历史记录。
可以方便快捷地清除您所有的电脑和网络浏览的历史记录。他可以清理多种程序的历史,诸如IE,Firefox, Windows Media Player, MSN等.除此以外,它还可以清理您的剪贴板,最近打开的文件,windows运行历史和清空回收站等,为...
在地址栏里输入这个文件的上级路径时,就会自动弹出下拉菜单,包括与此相关的各个最近访问过的文件路径,很是烦人那么应该怎样清除掉这个记录呢?今天u大师就教大家如何清除这些记录。 去除地址栏中的记录步骤/方法...
IE相关:InterNet临时文件、IE 浏览器地址栏、用户临时文件、Cookies目录和历史记录。 其他相关:Office“回收站”,任务栏被隐藏图标的历史记录。 点评:电脑记录清除器全面清理电脑使用记录,保护你的隐私。