如果也想像flashget那样在ie的右键菜单中显示一个下载选项的话
到注册表的
/HKEY_CURRENT_USER/software/microsoft/Internet Explorer/MenuExt/
看就知道是什么一回事啦
如果是自己写的程序用webbrowser想实现这种链接列表
//打开当前页面的所有链接
uses mshtml;
procedure Tfrmhtmlbrowser.N2Click(Sender: TObject);
var
OpenAllLinkForm: TOpenAllLinkForm;
Result: Integer;
doc: IHTMLDocument2;
all: IHTMLElementCollection;
len, i: integer;
item: OleVariant;
wb: tembeddedwb;
listitem: TListItem;
// j:Integer;
//iw: IWebBrowser2;
begin
WB := GetVisibleWebBrowser;
OpenAllLinkForm := TOpenAllLinkForm.Create(Self);
try
{判断是否多frame ,有时会出错,取消这功能
if wb.FrameCount > 0 then
for j := 0 to wb.framecount - 1 do
begin
iw := wb.GetFrame(j);
doc := iw.Document as IHTMLDocument2;
all := doc.Get_links; //doc.Links亦可
len := all.length;
for i := 0 to len - 1 do
begin
item := all.item(i, varempty); //EmpryParam亦可
if EnableIgnoreList then
if IgnoreList.IndexOf(item.href) = -1 then
begin
listitem := OpenAllLinkForm.ListView_link.Items.Add;
listitem.Caption := item.href;
listitem.SubItems.Add(item.innertext);
end;
end;
end
else
}
begin
//这段就是取链接
doc := wb.Document as IHTMLDocument2;
all := doc.Get_links; //doc.Links亦可
len := all.length;
for i := 0 to len - 1 do
begin
item := all.item(i, varempty); //EmpryParam亦可
if EnableIgnoreList then
if IgnoreList.IndexOf(item.href) = -1 then
begin
listitem := OpenAllLinkForm.ListView_link.Items.Add;
listitem.Caption := item.href;
listitem.SubItems.Add(item.innertext);
end;
end; //end for
//取链接结束
//open openalllinkform
Result := OpenAllLinkForm.Showmodal;
if Result = mrOk then //打开链接
for i := 0 to OpenAllLinkForm.ListView_link.Items.Count - 1 do
begin
application.ProcessMessages;
if OpenAllLinkForm.ListView_link.Items.Checked then
if BackList.IndexOf(OpenAllLinkForm.Listview_link.Items.Caption) = -1 then
newpages(OpenAllLinkForm.Listview_link.Items.Caption);
end;
end;
finally
OpenAllLinkForm.Free;
end;
end;
如果也想像flashget那样在ie的右键菜单中显示一个下载选项的话
到注册表的
/HKEY_CURRENT_USER/software/microsoft/Internet Explorer/MenuExt/
看就知道是什么一回事啦
你看注册表没有,其实就是2个htm文件,在文件中就是做取出链接,并加入到你应用程序的
列表中。netants和flashget的htm文件其实内容差不多的。
netants 取所有链接的htm
<script language="VBScript">
On Error Resume Next
set NetAntsApi = CreateObject( "NetAnts.API" ) //如果也想像netants那样,你要把自己的程序注册成com才行
if err<>0 then
Alert("NetAnts not properly installed on this PC!")
else
set links = external.menuArguments.document.links
ReDim params(links.length*2)
params(0)=external.menuArguments.document.Url
for i = 0 to links.length-1
params(i*2+1)=links(i).href
params(i*2+2)=links(i).innerText
next
NetAntsApi.AddUrlList params //加链接到应用程序的列表框或者其它中
end if
</script>