Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Poniższy przykład kodu pokazuje, jak otworzyć magazyn właściwości dla bieżącego obiektu wystąpienia funkcji. Procedura uzyskiwania bieżącego obiektu wystąpienia funkcji jest opisana w temacie Uzyskiwanie obiektu wystąpienia funkcji.
/**************************************************************************\
* CWSDDevice::OpenPropertyStore
*
* Opens the Property Store that is associated with the current Function Instance.
*
* Arguments:
*
* pPropertyStore - returns the IPropertyStore interface. The caller must
* release it by calling IPropertyStore::Release
* Return Value:
*
* S_OK if operation is successful, an error HRESULT otherwise
*
\**************************************************************************/
HRESULT
CWSDDevice::OpenPropertyStore(
__out IPropertyStore **ppPropertyStore)
{
HRESULT hr = S_OK;
if (!ppPropertyStore)
{
hr = E_INVALIDARG;
WIAS_ERROR((g_hInst, "Invalid argument, hr = 0x%08X", hr));
}
if (!m_pFunctionInstance)
{
hr = E_UNEXPECTED;
WIAS_ERROR((g_hInst, "Communication interface not initialized, hr = 0x%08X", hr));
}
if (SUCCEEDED(hr))
{
hr = m_pFunctionInstance->OpenPropertyStore(STGM_READ, ppPropertyStore);
if ((SUCCEEDED(hr)) && (!(*ppPropertyStore)))
{
hr = E_POINTER;
WIAS_ERROR((g_hInst,
"IFunctionInstance::OpenPropertyStore returned hr = 0x%08X with a NULL property store interface, hr = 0x%08X", hr));
}
if (FAILED(hr))
{
WIAS_ERROR((g_hInst, "IFunctionInstance::OpenPropertyStore failed, hr = 0x%08X", hr));
}
}
return hr;
}