HostProtectionAttribute.ExternalProcessMgmt Свойство

Определение

Возвращает или задает значение, указывающее, предоставляется ли возможность управлять внешними процессами.

public:
 property bool ExternalProcessMgmt { bool get(); void set(bool value); };
public bool ExternalProcessMgmt { get; set; }
member this.ExternalProcessMgmt : bool with get, set
Public Property ExternalProcessMgmt As Boolean

Значение свойства

Boolean

Значение true, если возможность управлять внешними процессам предоставляется, в противном случае — false. Значение по умолчанию — false.

Примеры

В следующем примере кода показано использование атрибута HostProtectionAttribute со свойством ExternalProcessMgmt . Этот пример является частью более крупного примера, предоставленного HostProtectionAttribute для класса.

// The following class is an example of code that exposes external process management.
// Add the LicenseProviderAttribute to the control.

[LicenseProvider(LicFileLicenseProvider::typeid)]
public ref class MyControl: public System::Windows::Forms::Control
{
private:

   // Create a new, null license.
   License^ license;

public:
   [HostProtection(ExternalProcessMgmt=true)]
   MyControl()
   {
      license = nullptr;
      
      // Determine if a valid license can be granted.
      bool isValid = LicenseManager::IsValid( MyControl::typeid );
      Console::WriteLine( "The result of the IsValid method call is {0}", isValid );
   }

};
// The following class is an example of code that exposes 
// external process management.
// Add the LicenseProviderAttribute to the control.
[LicenseProvider (typeof(LicFileLicenseProvider))]
public class MyControl : System.Windows.Forms.Control
{
    // Create a new, null license.
    private License license = null;

    [HostProtection (ExternalProcessMgmt = true)]
    public MyControl ()
    {
        // Determine if a valid license can be granted.
        bool isValid = LicenseManager.IsValid (typeof(MyControl));
        Console.WriteLine ("The result of the IsValid method call is " + 
            isValid.ToString ());
    }

    protected override void Dispose (bool disposing)
    {
        if (disposing)
        {
            if (license != null)
            {
                license.Dispose ();
                license = null;
            }
        }
    }
}
' The following class is an example of code that exposes 
' external process management.
' Add the LicenseProviderAttribute to the control.
<LicenseProvider(GetType(LicFileLicenseProvider))> _
Public Class MyControl
    Inherits System.Windows.Forms.Control

    ' Create a new, null license.
    Private license As License = Nothing

    <HostProtectionAttribute(ExternalProcessMgmt := True)> _
    Public Sub New()

        ' Determine if a valid license can be granted.
        Dim isValid As Boolean = LicenseManager.IsValid(GetType(MyControl))
        Console.WriteLine(("The result of the IsValid method call is " & _
            isValid.ToString()))
    End Sub

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (license Is Nothing) Then
                license.Dispose()
                license = Nothing
            End If
        End If
    End Sub
End Class

Комментарии

Код, предоставляющий управление внешними процессами, может создавать или уничтожать другие процессы.

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

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