IDSFDevice::HasObject Method

The HasObject method reports whether an object is associated with a DSFDevice object.


HRESULT HasObject(
  [in]           BSTR CLSID,
  [out, retval]  VARIANT_BOOL *pvBool


  • CLSID [in]
    The object class identifier (ID) to seek in the DSFDevice object.

  • pvBool [out, retval]
    Caller-allocated space to hold the search result.

Return Value

HasObject returns S_OK if the operation succeeds or E_POINTER if the pvBool parameter is not a valid pointer.

This method can also return other standard COM return values.


The following VBScript code example shows how to determine whether a DSFDevice object contains an object that is identified with a given GUID.

Private Function EnumSimulatedDevices(SearchObjectGUID)

    Dim DevSought   : Set DevSought = Nothing
    Dim Dev         : Set Dev = Nothing
    Dim DSF         : Set DSF = CreateObject("DSF.DSF")
    Dim ObjSought   : Set ObjSought = Nothing

    For Each Dev in DSF.Devices
        If Dev.HasObject(SearchObjectGUID) Then
            Set ObjSought = Dev.Object(SearchObjectGUID)
            If Not ObjSought Is Nothing Then
                Set DevSought = Dev
            End If
        End If

    Set EnumSimulatedDevices = DevSought

End Function

See Also




Send comments about this topic to Microsoft

Build date: 9/21/2010