From MediaMonkey Wiki
Jump to: navigation, search

CoClass SDBDevice, Interface ISDBDevice

Property Get HandledDeviceList As ISDBDeviceList

Property description

Returns list of devices connected to the computer as SDBDeviceList

But inlike ActiveDeviceList it returns only devices that are already handled by a device plugin and thus their DeviceHandle is always valid.

Introduced in MediaMonkey version 4.1.1.


Option Explicit
Dim UI  : Set UI = SDB.UI
Sub OnStartUp()
    Dim mnuTest
    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = SDB.Localize("Get devices")
    mnuTest.OnClickFunc = "SDBOnClick"
    mnuTest.UseScript = Script.ScriptPath    
End Sub
Sub SDBOnClick(Item)   
  Dim list : Set list = SDB.Device.HandledDeviceList
  If list.Count = 0 Then
    Call SDB.MessageBox( "No connected device", mtError, Array(mbOk))
    Exit Sub
  End If
  Dim txt
  Dim i : i = 0
  For i = 0 To list.Count-1    
    txt = SDB.Device.Caption( list.DeviceHandle(i))
    Call SDB.MessageBox( txt, mtInformation, Array(mbOk))
End Sub