Share via


IDSFBus::Name Property

The Name property retrieves the name of the bus.

This property is read-only.

Syntax

HRESULT get_Name(
  [out, retval]  BSTR *pbstrName
);

Property Value

A pointer to the caller's BSTR variable. If this property successfully return, this variable will be set to a BSTR value that points to the bus name. The caller must free the returned string by calling the SysFreeString OLE automation API function. For more information about SysFreeString, see the MSDN Library.

Error Codes

Name returns S_OK if the bus name is returned successfully or E_POINTER if the bstrName parameter is not a valid pointer.

This property can also return many standard COM return values.

Examples

The following VBScript code example shows how to find the USB 2.0 controller simulator by name.

const IID_IDSFBus   = "{E927C266-5364-449E-AE52-D6A782AFDA9C}"

Dim Bus : Set Bus = FindUSBBus(IID_IDSFBus)

Private Function FindUSBBus(SearchObjectGUID)
 
    Dim Bus    : Set Bus = Nothing
    Dim Dev    : Set Dev = Nothing
    Dim DSF    : Set DSF = CreateObject("DSF.DSF")

    For Each Dev in DSF.Devices
        If Dev.HasObject(SearchObjectGUID) Then
            Set Bus = Dev.Object(SearchObjectGUID)
            If Not Bus Is Nothing Then
                If Bus.Name = "USB2.0"Then
                    Exit For
                Else
                    Set Bus = Nothing
                End If
            End If
        End If
    Next

    Set FindUSBBus = Bus

End Function

Requirements

Header

DSFif.h

See Also

IDSFBus

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010