HostProtectionAttribute.ExternalProcessMgmt 属性
定义
获取或设置一个值,该值指示是否公开外部进程管理。Gets or sets a value indicating whether external process management is exposed.
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
属性值
如果公开外部进程管理,则为 true,否则为 false。true if external process management is exposed; otherwise, false. 默认值为 false。The default is false.
示例
下面的代码示例演示如何将 HostProtectionAttribute 属性与属性结合使用 ExternalProcessMgmt 。The following code example illustrates the use of the HostProtectionAttribute attribute with the ExternalProcessMgmt property. 此示例是为类提供的更大示例的一部分 HostProtectionAttribute 。This example is part of a larger example provided for the HostProtectionAttribute class.
// 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
注解
公开外部进程管理的代码可能会创建或销毁其他进程。Code that exposes external process management might create or destroy other processes.