IFeatureSupport Arabirim

Tanım

Geçerli sistemden özellik bilgilerini almak için standart bir arabirim belirtir.

public interface class IFeatureSupport
public interface IFeatureSupport
type IFeatureSupport = interface
Public Interface IFeatureSupport
Türetilmiş

Örnekler

Aşağıdaki örnek, özellik için LayeredWindows ve sorgularının IFeatureSupport uygulamasını kullanırOSFeature. Sürüm, özelliğin mevcut olup olmadığını belirlemek için olup olmadığını görmek nulliçin denetlendi. Sonuç bir metin kutusunda görüntülenir. Bu kod, oluşturulduğunu ve bir forma yerleştirildiğini varsayar textBox1 .

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

Açıklamalar

Bir sınıfta uygulandığında, IFeatureSupport bir özelliğin sistemde yüklü olup olmadığını belirlemek ve bir özelliğin sürüm numarasını almak için kullanabileceğiniz yöntemler sağlar. Bir özelliğin veya özelliğin belirli bir sürümünün şu anda yüklü olup olmadığını belirlemek için çağrısı IsPresent . Yüklü bir özelliğin sürüm numarasını belirlemek için çağrısı GetVersionPresent .

Bu arabirimin FeatureSupport uygulamaları için ve OSFeature sınıflarına bakın.

Yöntemler

GetVersionPresent(Object)

Belirtilen özelliğin sürümünü alır.

IsPresent(Object)

Belirtilen özelliğin herhangi bir sürümünün şu anda sistemde kullanılabilir olup olmadığını belirler.

IsPresent(Object, Version)

Belirtilen özelliğin belirtilen veya daha yeni bir sürümünün şu anda sistemde kullanılabilir olup olmadığını belirler.

Şunlara uygulanır

Ayrıca bkz.