IFeatureSupport.IsPresent Methode

Definitie

Bepaalt of de opgegeven functie momenteel beschikbaar is op het systeem.

Overloads

Name Description
IsPresent(Object)

Bepaalt of een versie van de opgegeven functie momenteel beschikbaar is op het systeem.

IsPresent(Object, Version)

Bepaalt of de opgegeven of nieuwere versie van de opgegeven functie momenteel beschikbaar is op het systeem.

IsPresent(Object)

Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs

Bepaalt of een versie van de opgegeven functie momenteel beschikbaar is op het systeem.

public:
 bool IsPresent(System::Object ^ feature);
public bool IsPresent(object feature);
abstract member IsPresent : obj -> bool
Public Function IsPresent (feature As Object) As Boolean

Parameters

feature
Object

De functie die moet worden gezocht.

Retouren

true als de functie aanwezig is; anders, false.

Voorbeelden

In het volgende voorbeeld wordt de OSFeature implementatie van IFeatureSupport en query's voor de LayeredWindows functie gebruikt. De versie wordt gecontroleerd om te zien of deze is null, om te bepalen of de functie aanwezig is. Het resultaat wordt weergegeven in een tekstvak. Bij deze code wordt ervan uitgegaan dat textBox1 deze is gemaakt en op een formulier is geplaatst.

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

Zie ook

Van toepassing op

IsPresent(Object, Version)

Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs
Bron:
IFeatureSupport.cs

Bepaalt of de opgegeven of nieuwere versie van de opgegeven functie momenteel beschikbaar is op het systeem.

public:
 bool IsPresent(System::Object ^ feature, Version ^ minimumVersion);
public bool IsPresent(object feature, Version minimumVersion);
abstract member IsPresent : obj * Version -> bool
Public Function IsPresent (feature As Object, minimumVersion As Version) As Boolean

Parameters

feature
Object

De functie die moet worden gezocht.

minimumVersion
Version

Een Version weergave van het minimale versienummer van de functie die moet worden gezocht.

Retouren

true indien de aangevraagde versie van de functie aanwezig is; anders, false.

Voorbeelden

In het volgende voorbeeld wordt de OSFeature implementatie van IFeatureSupport en query's voor de LayeredWindows functie gebruikt. De versie wordt gecontroleerd om te zien of deze is null, om te bepalen of de functie aanwezig is. Het resultaat wordt weergegeven in een tekstvak. Bij deze code wordt ervan uitgegaan dat textBox1 deze is gemaakt en op een formulier is geplaatst.

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

Zie ook

Van toepassing op