Поделиться через


OSFeature.GetVersionPresent(Object) Метод

Определение

Извлекает версию указанной функции, доступной в настоящее время в системе.

public:
 override Version ^ GetVersionPresent(System::Object ^ feature);
public override Version GetVersionPresent(object feature);
public override Version? GetVersionPresent(object feature);
override this.GetVersionPresent : obj -> Version
Public Overrides Function GetVersionPresent (feature As Object) As Version

Параметры

feature
Object

Функция, версия которой запрашивается либо LayeredWindowsThemes.

Возвращаемое значение

Представляет Version версию указанной функции операционной системы, доступную в настоящее время в системе, или null если не удается найти эту функцию.

Примеры

В следующем примере запрашивается OSFeature функция LayeredWindows . Версия проверяется, есть ли она null, чтобы определить, присутствует ли эта функция. Результат отображается в текстовом поле. В этом коде 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";
      }
   }
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";
}
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
End Sub

Комментарии

Feature Используйте свойство, static экземпляр предоставленного OSFeature в этом классе, чтобы запросить номер версии компонента.

Применяется к

См. также раздел