A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Hi,
When I use INTERNET_FLAG_DONT_CACHE, the Seek() function throw an exception but when remove this flag it works! also when I combine INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_HYPERLINK it works again. Why?
CInternetFile::Seek is currently implemented using InternetSetFilePointer system function. If the data is not available from the cache and the server does not support random access might block or return pending.
This handle must not have been created with the INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_NO_CACHE_WRITE value set.
What is correct flag to download a file without out using the cache?
I suggest you could try to use INTERNET_FLAG_RELOAD flag to download a file without out using the cache.
Here is the code:
CInternetSession interSession(L" ", 1, PRE_CONFIG_INTERNET_ACCESS, NULL
, NULL, 0);
CHttpFile* pf = (CHttpFile*)interSession.OpenURL(url, 1,
INTERNET_FLAG_RELOAD);
What is difference between INTERNET_FLAG_RELOAD and mentioned flags?
INTERNET_FLAG_DONT_CACHE
Does not add the returned entity to the cache. This is identical to the preferred value, INTERNET_FLAG_NO_CACHE_WRITE
INTERNET_FLAG_HYPERLINK
Forces a reload if there is no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network. This flag can be used by FtpFindFirstFile, FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl.
INTERNET_FLAG_RELOAD
Forces a download of the requested file, object, or directory listing from the origin server, not from the cache. The FtpFindFirstFile, FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl functions use this flag.
For more details, I suggest you could refer to the Doc: API Flags
Best Regards,
Elya
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.