IFeatureSupport Interfejs

Definicja

Określa standardowy interfejs pobierania informacji o funkcji z bieżącego systemu.

public interface class IFeatureSupport
public interface IFeatureSupport
type IFeatureSupport = interface
Public Interface IFeatureSupport
Pochodne

Przykłady

W poniższym przykładzie użyto OSFeature implementacji funkcji IFeatureSupport i zapytań LayeredWindows . Wersja jest sprawdzana, czy jest nullto , aby określić, czy funkcja jest obecna. Wynik jest wyświetlany w polu tekstowym. Ten kod zakłada, że textBox1 został utworzony i umieszczony w formularzu.

private:
   void LayeredWindows()
   {
      // Gets the version of the layered windows feature.
      Version^ myVersion = OSFeature::Feature->GetVersionPresent(
         OSFeature::LayeredWindows );
      
      // Prints whether the feature is available.
      if ( myVersion != nullptr )
      {
         textBox1->Text = "Layered windows feature is installed.\n";
      }
      else
      {
         textBox1->Text = "Layered windows feature is not installed.\n";
      }

      
      // This is an alternate way to check whether a feature is present.
      if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) )
      {
         textBox1->Text = String::Concat( textBox1->Text,
            "Again, layered windows feature is installed." );
      }
      else
      {
         textBox1->Text = String::Concat( textBox1->Text,
            "Again, layered windows feature is not installed." );
      }
   }
private void LayeredWindows() {
   // Gets the version of the layered windows feature.
   Version myVersion = OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows);

   // Prints whether the feature is available.
   if (myVersion != null)
      textBox1.Text = "Layered windows feature is installed." + '\n';
   else
      textBox1.Text = "Layered windows feature is not installed." + '\n';

   // This is an alternate way to check whether a feature is present.
   if (OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
      textBox1.Text += "Again, layered windows feature is installed.";
   else
      textBox1.Text += "Again, layered windows feature is not installed.";
}
Private Sub LayeredWindows()
    ' Gets the version of the layered windows feature.
    Dim myVersion As Version = _
       OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows)
       
    ' Prints whether the feature is available.
    If (myVersion IsNot Nothing) Then
        textBox1.Text = "Layered windows feature is installed." & _
           ControlChars.CrLf
    Else
        textBox1.Text = "Layered windows feature is not installed." & _
           ControlChars.CrLf
    End If 
    'This is an alternate way to check whether a feature is present.
    If OSFeature.Feature.IsPresent(OSFeature.LayeredWindows) Then
        textBox1.Text &= "Again, layered windows feature is installed."
    Else
        textBox1.Text &= "Again, layered windows feature is not installed."
    End If
End Sub

Uwagi

W przypadku implementacji w klasie udostępnia metody, których można użyć do określenia, IFeatureSupport czy funkcja jest obecnie zainstalowana w systemie i aby uzyskać numer wersji funkcji. Wywołaj metodę IsPresent , aby określić, czy funkcja, czy określona wersja funkcji, jest obecnie zainstalowana. Wywołaj metodę GetVersionPresent , aby określić numer wersji zainstalowanej funkcji.

FeatureSupport Zobacz klasy i OSFeature dotyczące implementacji tego interfejsu.

Metody

GetVersionPresent(Object)

Pobiera wersję określonej funkcji.

IsPresent(Object)

Określa, czy dowolna wersja określonej funkcji jest obecnie dostępna w systemie.

IsPresent(Object, Version)

Określa, czy określona lub nowsza wersja określonej funkcji jest obecnie dostępna w systemie.

Dotyczy

Zobacz też