VB6 determines whether a connection is saved in Cache

xiaoxiao2021-03-06  112

Public Function GetCachentryInfo (Byval Hwnd As Long, Byval Lpszurl As String) AS Boolean

DIM DWENTRYSIZE AS Long

DIM LPCACHEENTRY AS Internet_Cache_ENTRY_INFO

DIM DWTEMP AS Long

DIM LERR AS Long

IF (geturlcacheentryinfo (lpszurl, byval 0 &, dwentrysize) = 0 THEN

LERR = Err.lastdllerror

IF (Lerr <> error_insufficient_buffer) THEN

'URL is not in Cache

Err.raise EeerrorBase 1, app.exename & ".mcacheentry", Winapierror (LERR)

GetCacheenTryInfo = FALSE

EXIT FUNCTION

Else

'URL Save in Cache

GetCachentryInfo = TRUE

END IF

END IF

END FUNCTION

Private submmand1_click ()

ON Error Goto Errorhandler

IF (getCacheentryInfo (Me.hwnd, Text1.Text))

MsgBox "URL is saved in cache.", Vbinformation

Else

MsgBox "URL is not saved in cache.", Vbinformation

END IF

EXIT SUB

Errorhandler:

MsgBox "URL is not saved in cache [" & Err.Description & "]", Vbinformation

End Sub

Private sub flow_load ()

Form1.currentx = 150: Form1.currenty = 60

Form1.print "Enter the URL in Text1, press Command1 Detection"

TEXT1.TEXT = "" "

Command1.default = TRUE

End Sub

Run the program, enter the URL address in TextBox (for example http://member.netease.com/~blackcat), then click Command1

Button, if the URL is in cache, the program pops up the message box to display the URL Save in Cache

转载请注明原文地址:https://www.9cbs.com/read-103723.html

New Post(0)