Difference between revisions of "ISDBDeviceList::DeviceHandle"

From MediaMonkey Wiki
Jump to: navigation, search
(Parameters)
m (declaration)
 
Line 1: Line 1:
 +
{{MethodDeclaration|SDBDeviceList|ISDBDeviceList|Function DeviceHandler(Index As Long) As Long}}
 +
 
===Parameters===
 
===Parameters===
  
 
{{MethodParameters  
 
{{MethodParameters  
  |Index |Long | Added in MM version 4.1}}
+
  |Index |Long | }}
  
 
===Property description===
 
===Property description===
  
Returns device handle so that device can be controlled by VB/JS script.  
+
Returns device handle so that device can be controlled by script.  
 
If the device is disconnected or not handled by any device plugin, then returns -1
 
If the device is disconnected or not handled by any device plugin, then returns -1
  
See example below:
+
{{Introduced|4.1}}
 
 
  
 
===Example===
 
===Example===

Latest revision as of 21:21, 20 April 2013

CoClass SDBDeviceList, Interface ISDBDeviceList

Function DeviceHandler(Index As Long) As Long


Parameters

Name Type Description
Index Long


Property description

Returns device handle so that device can be controlled by script. If the device is disconnected or not handled by any device plugin, then returns -1

Introduced in MediaMonkey version 4.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("Sync Now Playing to Galaxy Nexus")
    mnuTest.OnClickFunc = "SDBOnClick"
    mnuTest.UseScript = Script.ScriptPath    
End Sub
   
Sub SDBOnClick(Item)   
  Dim DeviceHandle : DeviceHandle = -1
  Dim Devices : Set Devices = SDB.Device.ActiveDeviceList("VID_04E8&PID_6860")
  Dim i : i = 0 
  For i = 0 To Devices.Count-1
	   If Devices.DeviceHandle(i) <> -1 Then
		   DeviceHandle = Devices.DeviceHandle(i)
	   End If
  Next
  
  SDB.Device.StartSynch DeviceHandle, SDB.Player.CurrentSongList
End Sub