IWMSContext::SetDateValue
Previous | Next |
IWMSContext::SetDateValue
The SetDateValue method specifies a DATE value in the context.
Syntax
HRESULT SetDateValue( LPCWSTR pstrName, long lNameHint, DATE dateValue, long lOptions );
Parameters
pstrName
[in] LPCWSTR specifying the name portion of the name-value pair in the context.
lNameHint
[in] long containing an optional key that can be used to more efficiently access a value.
dateValue
[in] DATE value specifying the DATE value for the context. 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 |
lOptions
[in] long containing either zero or the WMS_CONTEXT_SET_PROPERTY_NAME_BY_VALUE enumeration flag defined in the WMS_CONTEXT_OPTIONS enumeration type. By default, the name is specified by reference.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Number | Description |
E_INVALIDARG | 0x80070057 | The pstrName parameter is NULL. |
E_OUTOFMEMORY | 0x8007000E | Could not allocate memory for the value. |
Remarks
The current release has no public contexts that contain a DATE value, but you can set a custom value in a context and retrieve it later. The server does not recognize custom values.
Example Code
// Declare variables. HRESULT hr; DATE dt; // Use a pointer to the server to retrieve the time // and date at which the server was last started. hr = pServer->get_StartTime(&dt); if (FAILED(hr)) goto EXIT; // Use a pointer to an existing context to add a SAFEARRAY. if (NULL != pUSerContext) { hr = pUSerContext->SetDateValue( L"Start_Time", WMS_CONTEXT_NO_NAME_HINT, dt, WMS_CONTEXT_SET_PROPERTY_NAME_BY_VALUE if (FAILED(hr)) goto EXIT; } EXIT: // Release temporary objects.
Requirements
Header: wmscontext.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
Previous | Next |