IDSF::WriteState Method
The WriteState method writes the public state of the driver that the specified GUID specifies.
Syntax
HRESULT WriteState(
[in] DSFStateType Type,
[in] BSTR Guid,
[in] DSFPropertyBag *pDSFPropertyBag
);
Parameters
Type [in]
The type of state to be written.Guid [in]
The GUID of the driver whose state is to be written.pDSFPropertyBag [in]
A pointer to the state to be written.
Return Value
WriteState returns S_OK if the public state is written correctly or E_INVALIDARG if the Type parameter is not a valid DSFDefaultStateType.
This method can also return many standard COM return values.
Remarks
Currently, DSF supports only DSFDefaultStateType as the state type.
Examples
The following C++ code example shows you how to write the public state for a given driver.
HRESULT CMyDevice::WriteSaveState(BSTR bstrGuid, IDSFPropretyBag *piDSFPropertyBag)
{
DSFStateType Type = DSFDefaultStateType;
HRESULT hr = S_OK;
//Read the saved state for this device
hr = m_piDSFObject->WriteState(Type, bstrGuid, reinterpret_cast<DSFPropertyBag**>(&piDSFPropertyBag));
return hr;
}
The following VBScript code example shows you how write the public state for a given driver.
Dim PropBag : Set PropBag = CreateObject("DSF.DSFPropertyBag")
' The main DSF object
Dim DSF : Set DSF = CreateObject("DSF.DSF")
' Set the property members so that DriverEntry will fail with STATUS_INSUFFICIENT_RESOURCES
PropBag.Write "DriverEntryStatus", &HC000009A
' Set the remaining PropertyBag entries for the DSFToaster to STATUS_SUCCESS
PropBag.Write "StartDeviceStatus ", &H00000000
PropBag.Write "AddDeviceStatus", &H00000000
' Write the property bag data
DSF.WriteState DSFDefaultStateType,"{9605ee38-896d-4736-9937-bf90a578aca9}", PropBag
Requirements
Header |
DSFif.h |
See Also
Send comments about this topic to Microsoft
Build date: 9/21/2010