Translation from http://blog.csdn.net/CathyEagle/archive/2004/11/05/167900.aspx
Private declare function geturlcacheentryinfo lib "wininet. DLL "alias _ <br/>" geturlcacheentryinfow "(byval lpszurlname as long, byval lpcacheentryinfo AS _ <br/> long, byref lpdwcacheentryinfobuffersize as long) as long </P> <p> private const error_insufficient_buffer as long = 122 </P> <p> private declare sub copymemory lib "kernel32.dll" alias "rtlmovemory" (byval destination as long, byval source as long, byval length as long) <br/> private declare function sysallocstring lib "oleaut32.dll" (byval polechar as long) as string </P> <p> private type filetime <br/> dwlowdatetime as long <br/> dwhighdatetime as long <br/> end type </P> <p> private type internet_cache_entry_info <br/> dwstructsize as long <br/> lpszsourceurlname as long <br/> lpszlocalfilename as long <br/> cacheentrytype as long <br/> dwusecount as long <br/> dwhitrate as long <br/> dwsizelow as long <br/> dwsizehigh as long <br/> lastmodifiedtime as filetime <br/> expiretime as filetime <br/> lastaccesstime as filetime <br/> lastsynctime as filetime <br/> lpheaderinfo as long <br/> dwheaderinfosize as long <br/> lpszfileextension as long <br/> 'Union {<br/> 'dword dwreserved; <br/> 'dword dwexemptdelta; <br/> '} <br/> dwreserved as long <br/> end type </P> <p> private function getpathfromurl (lpszurl $) as string </P> <p> dim dwentrysize & </P> <p> dim lpcacheentry as internet_cache_entry_info </P> <p> dim lpcacheentrybyte () as byte </P> <p> dim strtemp (80) as byte <br/> dim dwtemp & </P> <p> 'assume that lpszurl is the image URL. <br/> call geturlcacheentryinfo (strptr (lpszurl), 0, dwentrysize) </P> <p> If err. lastdllerror = error_insufficient_buffer then <br/> redim lpcacheentrybyte (dwentrysize) <br/> debug. print dwentrysize <br/> 'lpcacheentry = (lpinternet_cache_entry_info) New char [dwentrysize]; <br/> else <br/> exit function <br/> end if </P> <p> err. clear </P> <p> call geturlcacheentryinfo (strptr (lpszurl), varptr (lpcacheentrybyte (0), dwentrysize) <br/> debug. print err. lastdllerror <br/> 'if err. lastdllerror = 0 then <br/> '// lpcacheentry-> lpszlocalfilename is the name of the lpszurl file in the cache. <br/> 'Return true; </P> <p> copymemory varptr (lpcacheentry), varptr (lpcacheentrybyte (0), Len (lpcacheentry) </P> <p> getpathfromurl = strconv (sysallocstring (lpcacheentry. lpszlocalfilename), vbfromunicode) <br/> 'end If </P> <p> end Function