Check if a File is in Internet Explorers Cache

类别:.NET开发 点击:0 评论:0 推荐:

Description

This function can be called to determine if a file is in Internet Explorers cache.

Code

Private Declare Function GetUrlCacheEntryInfo Lib "wininet.dll" Alias _
    "GetUrlCacheEntryInfoA" _
    (ByVal sUrlName As String, _
    lpCacheEntryInfo As Any, _
    lpdwCacheEntryInfoBufferSize As Long) As Long

Function Cached(ByVal strURL As String) As Boolean
    Dim buffer As Long
    
    If (GetUrlCacheEntryInfo(strURL, ByVal 0&, buffer)) = 0 Then
    If (Err.LastDllError = 122) Then Cached = True
        
End Function

 

Example Usage

Just call the function and give it the url of the file you want to check:

MsgBox Cached("http://msdn.microsoft.com/")

本文地址:http://com.8s8s.com/it/it43986.htm