Share via


IWMSDataContainerVersion::SetLastModifiedTime

banner art

Previous Next

IWMSDataContainerVersion::SetLastModifiedTime

The SetLastModifiedTime method specifies the last time the data container was modified.

Syntax

  HRESULT SetLastModifiedTime(
  DATE  dateLastModifiedTime
);

Parameters

dateLastModifiedTime

[in] DATE containing the date and time at which the container was last modified. The DATE type is implemented using an 8-byte floating point number. Days are represented by whole number increments starting with midnight on 30 December 1899 as time zero. Hour values are expressed as the absolute value of the fractional part of a day. This is illustrated in the following table.

Date Value
30 December 1899, midnight 0.00
30 December 1899, noon 0.50
1 January 1900, midnight 2.00
4 January 1900, midnight 5.00
4 January 1900, 6 A.M. 5.25
4 January 1900, noon 5.50
4 January 1900, 9 P.M. 5.875

Return Values

If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.

Example Code

Data source plug-ins that retrieve data from files can specify the time at which the file was last modified. The following example uses the current system time on the local computer.

// Declare variables.
HRESULT hr = S_OK;
DATE dateOriginLastModifiedTime;
WIN32_FILE_ATTRIBUTE_DATA FileAttributeData;
SYSTEMTIME stLastModifiedTime;
IWMSDataContainerVersion *pVersion = NULL;
LPWSTR pszPath;

// Retrieve file attributes using a Win32 API call, GetFileAttributesEx.
GetFileAttributesEx( pszPath, GetFileExInfoStandard, &FileAttributeData )

// Convert the last modified time from FILETIME to DATE format.
FileTimeToSystemTime( &FileAttributeData.ftLastWriteTime, 
                      &stLastModifiedTime );
SystemTimeToVariantTime( &stLastModifiedTime, 
                         &dateOriginLastModifiedTime );

// Use a pointer to an IWMSClassObject interface, pClassFactory,
// to create an IWMSDataContainerVersion object.
hr = pClassFactory->CreateInstance( IID_IWMSDataContainerVersion,
                                    (void **) &pVersion );
if (FAILED(hr)) goto EXIT;

// Specify the last modified time.
hr = pVersion->SetLastModifiedTime( dateOriginLastModifiedTime );
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary objects.

Requirements

Header: datacontainerversion.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next