Share via


ISoftUSBConfigurations::Lock Method

The Lock method disables all changes to a collection of SoftUSBConfiguration objects until you call the ISoftUSBConfigurations::Unlock method.

Syntax

HRESULT Lock();

Parameters

This method has no parameters.

Return Value

Lock returns an HRESULT value. This method returns S_OK of the collection is locked.

Remarks

A caller can use only the ISoftUSBConfigurations::Count and ISoftUSBConfigurations::Item properties while the collection is locked.

The following C++ code example shows how to lock an ISoftUSBConfigurations collection.

HRESULT CTestDevice::GetConfigurationEnum(IUnknown *punkIU)
{
    HRESULT             hr = S_OK;
 ISoftUSBConfigurations  *piConfigList = NULL;


    // Get the configuration list
 hr = m_piDevice->get_Configurations(&piConfigList);
 if (FAILED(hr))
    {
 goto Exit;
    }

        // Lock the collection
 hr = piConfigList->Lock();
 if (FAILED(hr))
 goto Exit;

    // Get the enumerator for the collection
 hr = piConfigList->get__NewEnum(&punk);
 if(FAILED(hr))
 goto Exit;



 hr = piConfigList->Unlock();
 if (FAILED(hr))
 goto Exit;

Exit:
 if( NULL != piConfigList)
{
  piConfigList->Release();
 piConfigList = NULL;
} 
 return hr;
}

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBConfigurations::Count

ISoftUSBConfigurations::Item

ISoftUSBConfigurations::Unlock

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010