下载文件时,如何先到IE缓存里找,找不到的情况下才到网上下载?

shiningstar 2004-04-10 06:19:31
rt.
...全文
445 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
shiningstar 2004-04-12
  • 打赏
  • 举报
回复
Oh,yeah!! It's work well. 结贴.
YHW 2004-04-11
  • 打赏
  • 举报
回复
uses urlmon
用URLDownloadToFile函数,刚好是你说的功能。
aiirii 2004-04-11
  • 打赏
  • 举报
回复
>>如何先到IE缓存里找
比较难,一时没思路
flyinwuhan 2004-04-10
  • 打赏
  • 举报
回复
呵呵,这我就不太清楚了,等高手来吧
shiningstar 2004-04-10
  • 打赏
  • 举报
回复
可是ie下载了放在缓存里的东西好多都改名了啊,比如说xxx[1].jpg
flyinwuhan 2004-04-10
  • 打赏
  • 举报
回复
下载---〉用编程的还是手工的啊?

先到IE缓存里找:

function SearchDir( RootPath, FileName: String; var lstDir: TStrings ):BOOL;
var
i : Integer;
lstSubDir : TStrings;
wfd : WIN32_FIND_DATA;
hFind : THandle;
sTmp : String;
begin
//字符串列表必须动态生成
lstSubDir := TStringList.Create;

//找出所有下级子目录
if RootPath[Length(RootPath)] <>'\' then
RootPath := RootPath + '\';

hFind := FindFirstFile( PChar(RootPath + '*.*'), wfd );
if hFind <> INVALID_HANDLE_VALUE then
begin
if ( (wfd.dwFileAttributes =20)or(wfd.dwFileAttributes =16) ) and
( Length(StrPas(wfd.cFileName)) > 2 ) then
lstSubDir.Add( wfd.cFileName );

sTmp := StrPas( wfd.cFileName );

while ( FindNextFile( hFind, wfd ) <> NULL ) and
( sTmp <> StrPas(wfd.cFileName) ) do
begin
sTmp := StrPas(wfd.cFileName);
if ( (wfd.dwFileAttributes =20)or(wfd.dwFileAttributes =16) ) and
( Length(StrPas(wfd.cFileName)) > 2 ) then
lstSubDir.Add( wfd.cFileName );
end;
end;
Windows.FindClose( hFind );

for i := 0 to lstSubDir.Count -1 do
begin
lstDir.Add( RootPath + lstSubDir.Strings[i] );
end;

//这是递归部分,查找各子目录。
for i:=0 to lstSubDir.Count-1 do
begin
SearchDir( RootPath + lstSubDir.Strings[i] + '\', FileName, lstDir );
end;

//资源释放并返回结果。
Result := lstSubDir.Count > 0;
lstSubDir.Free;
end;
然后用FileExists判断你要下的文件是否在这些目录中

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧