IWMDMOperation::GetObjectTotalSize
Windows Media Device Manager calls GetObjectTotalSize before a file is written to the device in order to retrieve the total size of the object, in bytes.
Syntax
HRESULT GetObjectTotalSize(DWORD*pdwSize,DWORD*pdwSizeHigh);
Parameters
pdwSize
[out] Pointer to a DWORD that, on return, specifies the low-order bits of the object size in bytes.
pdwSizeHigh
[out] Pointer to a DWORD that, on return, specifies the high-order bits of the object size in bytes.
Return Values
The application should return one of the following HRESULT values.
Return code | Description |
S_OK | The read operation should continue. |
WMDM_E_USER_CANCELLED | The read operation should be cancelled without finishing. |
E_FAIL | An unspecified error occurred, and the read operation should be cancelled without finishing. |
If the application returns either E_FAIL or WMDM_E_USER_CANCELLED, the operation is cancelled and the End method is called. If the application is using block mode and returns WMDM_E_USER_CANCELLED, then Windows Media Device Manager will return this same error to the application.
Remarks
This method is called after the GetObjectAttributes method has been called. When transferring, the object implementing this interface is passed the total size of the content being sent.
Example Code
The following C++ code implements GetObjectTotalSize. It uses the Win32 function GetFileInformationByHandle to retrieve the file size of the file about to be written to the device (m_File), and returns the values.
// About to start writing to the device.
HRESULT GetObjectTotalSize(DWORD* pdwSize, DWORD* pdwSizeHigh)
{
BY_HANDLE_FILE_INFORMATION fileInfo;
GetFileInformationByHandle(
m_File,
&fileInfo);
*pdwSize = fileInfo.nFileSizeLow;
*pdwSizeHigh = fileInfo.nFileSizeHigh;
// TODO: Display the message: "IWMDMOperation event--GetObjectTotalSize."
return S_OK;
}
Requirements
Header: Defined in mswmdm.h.
Library: mssachlp.lib
See Also