Muokkaa

Jaa


AddInProcess.IsCurrentProcess Property

Definition

Gets a value that indicates whether the current AddInProcess object represents the host application process.

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

Property Value

true if the AddInProcess object corresponds to the current process; otherwise, false.

Examples

The following example activates an add-in in an external process and uses the IsCurrentProcess property to determine whether the add-in is in the same process as the host application process.

// 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)

Remarks

If the value of this property is true, the add-in is running in-process with the host application. In that case, using the Start or Shutdown method throws an InvalidOperationException.

Note

The AddInEnvironment.Process property returns an AddInProcess object that represents the host application process if the add-in is running in-process.

Applies to