Value Property

The Value property gets a string descriptor's string data.

This property is read/write.

Syntax

HRESULT put_Value(
  [in]           BSTR bstrString
);

HRESULT get_Value(
  [out, retval]  BSTR *pbstrString
);

Property Value

The new value for the string interface.

Error Codes

Value returns S_OK if the operation succeeds.

Remarks

The following C++ code example shows how to get and set the Value property.

HRESULT CTestDevice::CheckStrinngValue ()
{
HRESULT hr = S_OK;
BSTR                        bstrSerialNumber = ::SysAllocString(L"23498-34");
BSTR                        bstrCurrentValue;

 hr = m_piString->get_Value(&bstrCurrentValue);
 if (FAILED(hr))
  goto Exit;

//Comapre the string values
 if (0 != ::memcmp(bstrCurrentValue, bstrSerialValue, ::SysStringByteLen(bstrCurrentValue))
{
 //Replace the string
  hr = m_piString->put_Value(bstrSerialNumber);
}
 
Exit:
::SysFreeString(bstrSerialNumber);
::SysFreeString(bstrCurrentValue); 
 return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBString

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010