| BOOL WINAPI WebGetObjectSize( |
| |
HSTORAGE hStorage, |
|
| |
LPCTSTR lpszObjectLabel, |
|
| |
LPDWORD lpdwObjectSize |
|
| ); |
The WebGetObjectSize function returns the size of the stored object.
Parameters
- hStorage
- A handle to the storage container.
- lpszObjectLabel
- A null-terminated string that specifies the label
of the storage object. This parameter cannot be a NULL pointer.
- lpdwObjectSize
- A pointer to an unsigned integer value that will contain
the size of the object. If this parameter is NULL, the parameter is
ignored and the function only checks for the existence of an object
that matches the specified label.
Return Value
If the function succeeds, the return value is non-zero. If the function
fails, the return value is zero. To get extended error information, call
WebGetLastError.
Remarks
The WebGetObjectSize function is used to retrieve the
size of a stored object on the server. This function can also be used as
a simple method to determine if the specified object exists. An object
size of zero means the object exists, but currently has no data associated
with it.
If the lpObjectSize parameter is not NULL, its value is
initialized to zero when the function is called, and updated with the
object size when the function returns.
Although storage object labels are similar to Windows file names,
they are case-sensitive. When requesting the size of an object, your
application must specify the label name exactly as it was created. The
object label cannot contain wildcard characters.
The WebGetObjectInformation function can be used
to obtain the metadata associated with the storage object, including
the size, content type, creation date and a SHA-256 digest of the data.
To obtain information about how much storage your applications are
using and the total number of stored objects, use the
WebGetStorageQuota function.
Example
DWORD dwObjectSize;
if (WebGetObjectSize(hStorage, lpszObjectLabel, &dwObjectSize))
{
_tprintf(_T("The size of \"%s\" is %lu bytes\n"), lpszObjectLabel, dwObjectSize);
}
else
{
TCHAR szError[128];
WebGetErrorString(WebGetLastError(), szError, 128);
_tprintf(_T("Unable to get the size of \"%s\" (%s)\n"), lpszObjectLabel, szError);
}
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cswebv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
WebGetObject,
WebGetObjectInformation,
WebGetObjectTime,
WebGetStorageQuota,
WebPutObject
|