CreateUrlCacheEntry Function
CreateUrlCacheEntry Function

Creates a local file name for saving the cache entry based on the specified URL and the file name extension.

Syntax

BOOLAPI CreateUrlCacheEntry(
  __in        LPCTSTR lpszUrlName,
  __in        DWORD dwExpectedFileSize,
  __in        LPCTSTR lpszFileExtension,
  __out       LPTSTR lpszFileName,
  __reserved  DWORD dwReserved
);


Parameters

lpszUrlName [in]

Pointer to a string value that contains the name of the URL. The string must contain a value; an empty string will cause CreateUrlCacheEntry to fail. In addition, the string must not contain any escape characters.

dwExpectedFileSize [in]

Expected size of the file needed to store the data that corresponds to the source entity, in TCHARs. If the expected size is unknown, set this value to zero.

lpszFileExtension [in]

Pointer to a string value that contains an extension name of the file in the local storage.

lpszFileName [out]

Pointer to a buffer that receives the file name. The buffer should be large enough to store the path of the created file (at least MAX_PATH + 1 characters in length).

dwReserved [in]

This parameter is reserved and must be 0.

Return Value

If the function succeeds, the function returns TRUE.

If the function fails, it returns FALSE. To get extended error information, call GetLastError.

Remarks

After CreateUrlCacheEntry is called, the application can write directly into the file in local storage. When the file is completely received, the caller should call CommitUrlCacheEntry to commit the entry in the cache.

WinINet attempts to decode Unicode parameters according to the system code page. Applications should ensure that Unicode parameters are properly encoded for the system code page. Applications can set the system code page with InternetSetOption as shown in the following code example:

DWORD CP_SHIFT_JIS = 932;  // ANSI/OEM  Japanese, Shift-JIS
InternetSetOption( hRequest, 
                   INTERNET_OPTION_CODEPAGE,
                   &CP_SHIFT_JIS, 
                   sizeof(DWORD) );

If the Unicode parameter is not properly encoded to the system code page, WinINet attempts UTF8 decoding.

When items are retrieved from the cache, the system code page that was used to place the item in the cache must match the current system code page for the user. For applications running under IE6 and earlier, if decoding for the system code page fails, WinINet attempts UTF8 decoding.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
VersionInternet Explorer 3.0 or later
HeaderWininet.h
LibraryWininet.lib
DLLWininet.dll
Unicode and ANSI namesCreateUrlCacheEntryW (Unicode) and CreateUrlCacheEntryA (ANSI)

See Also

Caching
WinINet Functions
CommitUrlCacheEntry

Send comments about this topic to Microsoft

Build date: 11/19/2009

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View