SetEnable Method

Summary
Enables or disables a DirectShow filter.
Syntax
C#
C++/CLI
public void SetEnable( 
   string Name, 
   bool Value 
) 
public: 
void SetEnable(  
   String^ Name, 
   bool Value 
)  

Parameters

Name
A string that represents the Display Name or Friendly Name of the filter. It is best to use "Display Name" since it is unique and no two filters can have the same Display Name. On the contrary, two or more filters can have have the same Friendly Name. When two or more filters have the same Friendly name, this function works on the first filter it internally enumerates having the specified friendly name.

Value
true to enable the filter, false to disable it. This only works if the filter's original merit is 0x200000 (MERIT_DO_NOT_USE). Setting this value to false will set the merit to 0x200000 (MERIT_DO_NOT_USE). Setting the SetEnable value to true restores the original merit value to the filter.

Remarks

For more information, refer to the Microsoft documentation for DirectShow Merits https://learn.microsoft.com/en-us/windows/win32/directshow/merit?view=netframework-4.8, https://learn.microsoft.com/en-us/previous-versions/aa920889(v=msdn.10)?view=netframework-4.8, and DirectShow Merits. 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 one or more filters can have 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"

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
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 for the 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 the LEAD Audio SPDIF Passthru filter 
      filterEnum.SetEnable(LeadAudioSpdifPassthru, isEnableNew); 
 
      // Get the Enable value again 
      isEnable = filterEnum.GetEnable(LeadAudioSpdifPassthru); 
 
      // Check and see whether the value has been set correctly 
      _result = (isEnable == isEnableNew) ? true : false; 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.