Redigera

Dela via


AddInProcess Class

Definition

Provides an external process for running add-ins out-of-process from the host application.

public ref class AddInProcess sealed
public sealed class AddInProcess
type AddInProcess = class
Public NotInheritable Class AddInProcess
Inheritance
AddInProcess

Examples

The following example activates an add-in in an external 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

To activate an add-in in an external process, pass an AddInProcess object to the appropriate AddInToken.Activate<T>(AddInProcess, PermissionSet) method overload.

The executable that runs the add-in is obtained from one of two files installed with the .NET Framework under the Windows directory. By default, the executable that matches the bits-per-word of the host application is used. If the host is a 64-bit process, AddInProcess.exe is run; otherwise, AddInProcess32.exe is run. To specify the way the executable is selected, use the AddInProcess(Platform) constructor to create the AddInProcess object.

Constructors

AddInProcess()

Initializes a new instance of the AddInProcess class.

AddInProcess(Platform)

Initializes a new instance of the AddInProcess class, specifying the bits-per-word of the process in which the add-in runs.

Properties

IsCurrentProcess

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

KeepAlive

Gets or sets a value that indicates whether to keep the external process alive.

Platform

Gets the bits-per-word of the process in which the out-of-process add-in is run.

ProcessId

Gets the process ID of the external process.

StartupTimeout

Gets or sets the number of seconds to allow for the process to start.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Shutdown()

Forcibly shuts down the external process.

Start()

Starts the external process.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

ShuttingDown

Occurs when the process represented by the AddInProcess object is about to be shut down.

Applies to

See also