Freigeben über


AddInProcess.IsCurrentProcess Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob das aktuelle AddInProcess Objekt den Hostanwendungsprozess darstellt.

public:
 property bool IsCurrentProcess { bool get(); };
public bool IsCurrentProcess { get; }
member this.IsCurrentProcess : bool
Public ReadOnly Property IsCurrentProcess As Boolean

Eigenschaftswert

true wenn das AddInProcess Objekt dem aktuellen Prozess entspricht; andernfalls false.

Beispiele

Im folgenden Beispiel wird ein Add-In in einem externen Prozess aktiviert und die IsCurrentProcess Eigenschaft verwendet, um zu bestimmen, ob sich das Add-In im gleichen Prozess wie der Hostanwendungsprozess befindet.

// Create an external process.
AddInProcess pExternal = new AddInProcess();

// Activate an add-in in the external process
// with a full trust security level.
Calculator CalcAddIn4 =
    selectedToken.Activate<Calculator>(pExternal,
    AddInSecurityLevel.FullTrust);

// Show that the add-in is an external process
// by verifying that it is not in the current (host's) process.
AddInController AddinCtl = AddInController.GetAddInController(CalcAddIn4);
Console.WriteLine("Add-in in host's process: {0}",
    AddinCtl.AddInEnvironment.Process.IsCurrentProcess);
' Create an external process.
Dim pExternal As New AddInProcess()

' Activate an add-in in the external process
' with a full trust security level.
Dim CalcAddIn4 As Calculator =
    selectedToken.Activate(Of Calculator)(pExternal,
        AddInSecurityLevel.FullTrust)

' Show that the add-in is an external process
' by verifying that it is not in the current (host's) process.
Dim AddinCtl As AddInController = AddInController.GetAddInController(CalcAddIn4)
Console.WriteLine("Add-in in host's process: {0}",
 AddinCtl.AddInEnvironment.Process.IsCurrentProcess)

Hinweise

Wenn der Wert dieser Eigenschaft lautet true, wird das Add-In mit der Hostanwendung im Prozess ausgeführt. In diesem Fall löst die Verwendung der Start Methode Shutdown eine InvalidOperationException.

Hinweis

Die AddInEnvironment.Process Eigenschaft gibt ein AddInProcess Objekt zurück, das den Hostanwendungsprozess darstellt, wenn das Add-In im Prozess ausgeführt wird.

Gilt für: