From MediaMonkey Wiki
Revision as of 17:45, 31 March 2014 by Ludek (talk | contribs) (Created page with "{{MethodDeclaration|SDBDevice|ISDBDevice|Property Get HandledDeviceList As ISDBDeviceList}} ===Property description=== Returns list of devices connected to the computer as [[S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.


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))
    Exit Sub       
End Sub