WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Delete Cache


Keywords: Cache History Removal Temporary Internet Files
Boxopen("History:","")
dll=DllLoad(strcat(dirwindows(1),"wininet.dll"))
ERROR_CACHE_FIND_FAIL=0

;Allocate Binary Buffers
MAX_SIZE=4096
bSize=BinaryAlloc(4) ;structure size
bICE=BinaryAlloc(MAX_SIZE) ;structure
ICEadd=intcontrol(42,bICE,0,0,0)
BinaryPoke4(bsize,0,MAX_SIZE)

;call to get info
hfind=DllCall(dll,long:"FindFirstUrlCacheEntryA",lpstr:"visited:",lpbinary:bICE,lpbinary:bSize)
BinaryEodSet(bICE,MAX_SIZE)
  
if hfind<>ERROR_CACHE_FIND_FAIL 
	purl=BinaryPeek4(bICE,4) ;url pointer    
	url=BinaryPeekstr(bICE,purl-ICEadd,MAX_SIZE)
	
	;Delete Cached URL
	BoxText(StrCat("Deleting: ",url))
	ret = DllCall(dll,long:"DeleteUrlCacheEntryA",lpstr:url)  
	if ret==@false
		Message("Error Deleting URL",StrCat(url,@crlf,"Error: ",DllLastError()))
		;exit
	endif
	
	while 1    
		;call to get info
		BinaryPoke4(bsize,0,MAX_SIZE)
		if !DllCall(dll,long:"FindNextUrlCacheEntryA",long:hfind,lpbinary:bICE,lpbinary:bSize) then break
		BinaryEodSet(bICE,MAX_SIZE)
		purl=BinaryPeek4(bICE,4)
		url=BinaryPeekStr(bICE,purl-ICEadd,MAX_SIZE)	 
		
		;Delete Cached URL
		BoxText(StrCat("Deleting: ",url))
		ret = DllCall(dll,long:"DeleteUrlCacheEntryA",lpstr:url)  
		if ret==@false
			Message("Error Deleting URL",StrCat(url,@crlf,"Error: ",DllLastError()))
			;exit
		endif
	
	endwhile
endif

DllFree(dll)
;Free Binary Buffers
BinaryFree(bSize)
BinaryFree(bICE)
exit

Article ID:   W16372
File Created: 2005:02:18:12:20:06
Last Updated: 2005:02:18:12:20:06