ISDBDevice::HandledDeviceList: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 39: Line 39:
     txt = SDB.Device.Caption( list.DeviceHandle(i))
     txt = SDB.Device.Caption( list.DeviceHandle(i))
     Call SDB.MessageBox( txt, mtInformation, Array(mbOk))
     Call SDB.MessageBox( txt, mtInformation, Array(mbOk))
    Exit Sub     
   Next  
   Next  
        
        

Latest revision as of 17:54, 31 March 2014

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.


Example

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