LEADTOOLS Multimedia (Leadtools.Multimedia assembly)
LEAD Technologies, Inc

Name Property (TargetDevice)

Example 





Gets a character string that contains the device's unique name.
Syntax
public string Name {get;}
'Declaration
 
Public ReadOnly Property Name As String
'Usage
 
Dim instance As TargetDevice
Dim value As String
 
value = instance.Name
public string Name {get;}
 get_Name(); 
public:
property String^ Name {
   String^ get();
}

Property Value

A character string that contains the device's unique name.
Remarks
Gets a character string that contains the device's unique name. The device's unique name can be used to uniquely identify a device. A program can save this name to persistent storage and use it later with the TargetDevices.IndexOf method to restore the device selection.
Example
Copy CodeCopy Code  
Public _result As Boolean = False
Public _form As ConvertCtrlForm = New ConvertCtrlForm()
Public Sub TargetDevicesExample()
  Dim inputName, inputFriendlyName As String
  Dim selectedCamera As Integer

  ' reference the convert control
  Dim convertctrl As ConvertCtrl = _form.ConvertCtrl

  Try
     ' get the target devices object
     Dim devices As TargetDevices = convertctrl.TargetDevices

     ' select an input by name if possible
     If devices("Microsoft DV Camera") Is Nothing Then
       Throw New Exception("No MS DV Camera device available!")
     End If

     devices("Microsoft DV Camera").Selected = True

     ' get the full friendly name of the device 
     Dim friendlyName As String = devices("Microsoft DV Camera").FriendlyName

     ' get the selected index of the currently selected target device
     ' (the MS DV camera above)
     selectedCamera = devices.Selection

     ' now enumerate all the target devices,
     ' looking for an audio device and select it
     For Each td As TargetDevice In devices
       ' get the inputs properties
       inputName = td.Name
       inputFriendlyName = td.FriendlyName

       ' if we found a target audio device
       If inputFriendlyName.Contains("Audio") Then
         ' select it and break
         td.Selected = True
         Exit For
       End If
     Next td

     ' set the result to what we expect
     _result = (selectedCamera <> devices.Selection)

  Catch e1 As Exception
     _result = False
  End Try
End Sub
public bool _result = false;
public ConvertCtrlForm _form = new ConvertCtrlForm();
public void TargetDevicesExample()
{
   string inputName, inputFriendlyName;
   int selectedCamera;

   // reference the convert control
   ConvertCtrl convertctrl = _form.ConvertCtrl;

   try
   {
      // get the target devices object
      TargetDevices devices = convertctrl.TargetDevices;

      // select an input by name if possible
      if (devices["Microsoft DV Camera"] == null)
         throw new Exception("No MS DV Camera device available!");

      devices["Microsoft DV Camera"].Selected = true;

      // get the full friendly name of the device 
      string friendlyName = devices["Microsoft DV Camera"].FriendlyName;

      // get the selected index of the currently selected target device
      // (the MS DV camera above)
      selectedCamera = devices.Selection;

      // now enumerate all the target devices,
      // looking for an audio device and select it
      foreach (TargetDevice td in devices)
      {
         // get the inputs properties
         inputName = td.Name;
         inputFriendlyName = td.FriendlyName;

         // if we found a target audio device
         if (inputFriendlyName.Contains("Audio"))
         {
            // select it and break
            td.Selected = true;
            break;
         }
      }

      // set the result to what we expect
      _result = (selectedCamera != devices.Selection);

   }
   catch (Exception)
   {
      _result = false;
   }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

TargetDevice Class
TargetDevice Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Multimedia requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features