LEADTOOLS Multimedia (Leadtools.Multimedia assembly) Send comments on this topic. | Back to Introduction | Help Version 17.0.3.22
SetEnable Method
See Also 
Leadtools.Multimedia Namespace > FilterEnum Class : SetEnable Method



Name
string to the Display Name or Friendly Name of the filter. It is always preferred to use "Display Name" since it is unique and no two filters can have the same Display Name. On the contrary, two filters or more might have the same Friendly Name. In this case this function will work on the first filter it internally enumerate with the specified friendly name.
Value
True to enable the filter, false to disable it. This only work if the filter origional merit is 0x200000 (MERIT_DO_NOT_USE). Setting this value to false will set the merit to 0x200000 (MERIT_DO_NOT_USE). Setting this value to true will bring back the orgional merit value.
Name
string to the Display Name or Friendly Name of the filter. It is always preferred to use "Display Name" since it is unique and no two filters can have the same Display Name. On the contrary, two filters or more might have the same Friendly Name. In this case this function will work on the first filter it internally enumerate with the specified friendly name.
Value
True to enable the filter, false to disable it. This only work if the filter origional merit is 0x200000 (MERIT_DO_NOT_USE). Setting this value to false will set the merit to 0x200000 (MERIT_DO_NOT_USE). Setting this value to true will bring back the orgional merit value.
Enables or disables a Directshow filter.

Syntax

Visual Basic (Declaration) 
Public Sub SetEnable( _
   ByVal Name As String, _
   ByVal Value As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As FilterEnum
Dim Name As String
Dim Value As Boolean
 
instance.SetEnable(Name, Value)
C# 
public void SetEnable( 
   string Name,
   bool Value
)
C++/CLI 
public:
void SetEnable( 
   String^ Name,
   bool Value
) 

Parameters

Name
string to the Display Name or Friendly Name of the filter. It is always preferred to use "Display Name" since it is unique and no two filters can have the same Display Name. On the contrary, two filters or more might have the same Friendly Name. In this case this function will work on the first filter it internally enumerate with the specified friendly name.
Value
True to enable the filter, false to disable it. This only work if the filter origional merit is 0x200000 (MERIT_DO_NOT_USE). Setting this value to false will set the merit to 0x200000 (MERIT_DO_NOT_USE). Setting this value to true will bring back the orgional merit value.

Example

Visual BasicCopy Code
Public _result As Boolean = False
Public _form As ConvertCtrlForm = New ConvertCtrlForm()
Public Sub FilterEnumEnableExample()
    Try
        Dim LeadAudioSpdifPassthru As String = "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{668B161A-9AB4-472D-8A48-550F7BD54F15}"

        ' Create an object instance of FilterEnum
        Dim filterEnum As FilterEnum = New FilterEnum

        ' Get the Enable value of LEAD Audio SPDIF Passthru filter
        Dim isEnable As Boolean = filterEnum.GetEnable(LeadAudioSpdifPassthru)

        ' Toggle the value and set it to a new variable
        Dim isEnableNew As Boolean = Not isEnable

        ' Set the new value to LEAD Audio SPDIF Passthru filter
        filterEnum.SetEnable(LeadAudioSpdifPassthru, isEnableNew)

        ' Get the Enable value again
        isEnable = filterEnum.GetEnable(LeadAudioSpdifPassthru)

        ' Check and see if the value has been set correctly
        If isEnable = isEnableNew Then
            _result = True
        Else
            _result = False
        End If

    Catch e1 As Exception
        _result = False
    End Try
End Sub
C#Copy Code
public bool _result = false;
public ConvertCtrlForm _form = new ConvertCtrlForm();
public void FilterEnumEnableExample()
{
   string LeadAudioSpdifPassthru = "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{668B161A-9AB4-472D-8A48-550F7BD54F15}";
   FilterEnum filterEnum = new FilterEnum();
   try
   {
      // Get the Enable value of LEAD Audio SPDIF Passthru filter
      bool isEnable = filterEnum.GetEnable(LeadAudioSpdifPassthru);

      // Toggle the value and set it to a new variable
      bool isEnableNew = !isEnable;

      // Set the new value to LEAD Audio SPDIF Passthru filter
      filterEnum.SetEnable(LeadAudioSpdifPassthru, isEnableNew);

      // Get the Enable value again
      isEnable = filterEnum.GetEnable(LeadAudioSpdifPassthru);

      // Check and see if the value has been set correctly
      _result = (isEnable == isEnableNew) ? true : false;
   }
   catch (Exception)
   {
      _result = false;
   }
}

Remarks

For more information, refer to the Microsoft documentation for DirectShow Merits http://msdn.microsoft.com/en-us/library/dd390674(VS.85).aspx http://msdn.microsoft.com/en-us/library/aa920889.aspx http://msmvps.com/blogs/chrisl/articles/40395.aspx A Display Name uniquely identifies a Directshow filter (or any filter). Display names for a software filters have the following format: @device:sw:GUID\\GUID, example: Microsoft’s “MPEG-2 Splitter” display name is: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{3AE86B20-7BE8-11D1-ABE6-00A0C905F375}. A Friendly Name is not unique and there might be one or more filters with the same name. However, it is ideal for presenting a descriptive name in user interfaces. For example the Friendly Name for Microsoft’s MPEG-2 Splitter is "MPEG-2 Splitter"

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also