How to adopt function DeleteUrlCacheEntry in HMG

Other General Resources like icon sets, sound files etc.,

Moderator: Rathinagiri

Post Reply
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

How to adopt function DeleteUrlCacheEntry in HMG

Post by bpd2000 »

How to adopt function DeleteUrlCacheEntry in HMG
That removes the file associated with the source name from the cache, if the file exists.
Syntax C++:

BOOLAPI DeleteUrlCacheEntry(
_In_ LPCTSTR lpszUrlName
);

https://msdn.microsoft.com/en-us/librar ... s.85).aspx
BPD
Convert Dream into Reality through HMG
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: How to adopt function DeleteUrlCacheEntry in HMG

Post by KDJ »

For example, in this way:

Code: Select all

#include "hmg.ch"

MEMVAR _HMG_SYSDATA

FUNCTION Main()
  LOCAL cURL := "http://myURL"
  LOCAL nError

  IF DeleteUrlCacheEntry(cURL, @nError)
    MsgBox("Deleted!")
  ELSE
    //System Error Codes: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx
    MsgBox("Error code: " + HB_NtoS(nError))
  ENDIF

RETURN NIL

#pragma BEGINDUMP
#include <windows.h>
#include <Wininet.h>
#include "hbapi.h"
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"

      // DeleteUrlCacheEntry(cURL[, @nError])
HB_FUNC( DELETEURLCACHEENTRY )
{
  BOOL  bRetVal = DeleteUrlCacheEntry((LPCTSTR) HMG_parc(1));
  DWORD nError  = GetLastError();

  if (HB_ISBYREF(2))
    hb_stornl(nError, 2);

  hb_retl(bRetVal);
}
#pragma ENDDUMP
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: How to adopt function DeleteUrlCacheEntry in HMG

Post by srvet_claudio »

A comment:
these header files should always go first

#include "SET_COMPILE_HMG_UNICODE.ch" #include "HMG_UNICODE.h"

because they activate / deactivate compilation in Unicode in the other header files
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: How to adopt function DeleteUrlCacheEntry in HMG

Post by bpd2000 »

Thank you Krzysztof
Thank you Dr. Claudio
BPD
Convert Dream into Reality through HMG
Post Reply