Share via


IDSF::HotPlug Method

The HotPlug method connects a simulated device into a specified simulated bus.

Syntax

HRESULT HotPlug(
  [in]           DSFDevice *pDSFDevice,
  [in]           BSTR bstrBus,
  [out, retval]  IDSFBus **ppiDSFBus
);

Parameters

  • pDSFDevice [in]
    A pointer to the IDSFDevice object to connect to the bus.

  • bstrBus [in]
    The GUID or friendly name of the bus to connect the device to. If this parameter is specified as a GUID, use a string in registry format (for example, "{00000000-1111-2222-3333-444444444444}").

  • ppiDSFBus [out, retval]
    A pointer to caller-allocated space in which to return an IDSFBus interface pointer on the specified bus. The caller must release this interface.

Return Value

HotPlug returns S_OK if the device is hot-plugged correctly or E_INVALIDARG if the bus cannot be found or if an un-powered device is plugged in.

This method can also return many standard COM return values.

Remarks

The HotPlug method tries to plug the device into the first available port on the first matching bus.

Examples

The following VBScript code example shows you how to use the HotPlug method to plug a loopback device into a USB 2.0 controller.

Dim LoopbackDev : Set LoopbackDev = WScript.CreateObject("SoftUSBLoopback.LoopbackDevice")
Dim DSF         : Set DSF = CreateObject("DSF.DSF")
Dim Bus         : Set Bus = DSF.HotPlug(LoopbackDev.DSFDevice, "USB2.0")

WScript.Echo "Press Enter after loopback device has enumerated to unplug it"
Dim x : x = WScript.ReadLine()

Bus.UnPlug LoopbackDSFDev

Requirements

Header

DSFif.h

See Also

IDSF

IDSFBus

IDSFBus::HotPlug

IDSFDevice

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010