共用方式為


Defining the Plug-in Load Type

When you register a plug-in, you can use the UnsupportedLoadTypes property to specify the load types supported by a plug-in. This property can have one of the following values.

Value

Description

0

The plug-in can be loaded as an in-process or out-of-process object. That is, the load type is not specified.

1

The plug-in cannot be loaded as an in-process object.

2

The plug-in cannot be loaded as an out-of-process object.

The following example illustrates how to use C# to specify that the plug-in cannot be loaded out-of-process. For more information, see Registering a .NET Plug-in.

    RegistryKey regHKCR = Registry.ClassesRoot;
    regHKCR = regHKCR.CreateSubKey("CLSID\\
               {E1171A34-1F13-46d9-AA8A-63F47E92207C}\\
               Properties");
    regHKCR.SetValue("UnsupportedLoadTypes", "2");

The following example illustrates how to use a registry script to specify that a plug-in cannot be loaded in-process.

HKCR
{
NoRemove CLSID
{
ForceRemove {0B2A7C4B-AEFE-4503-952F-219240E707D7} = s 'SamplePlugin Class'
   {
      ForceRemove Properties
      {
         val UnsupportedLoadTypes = s '1'
      }
   }
}
}

You can also use the LoadType property on the IWMSPlugin interface and the DefaultPluginLoadType property on the IWMSServer interface to identify the load type. These two properties use the WMS_PLUGIN_LOAD_TYPE enumeration type. This must contain one of the following values.

Value

Description

WMS_PLUGIN_LOAD_TYPE_UNSPECIFIED

The server determines whether to load the plug-in as an in-process or out-of-process object.

WMS_PLUGIN_LOAD_TYPE_IN_PROC

Instructs the server to load the plug-in as an in-process object.

WMS_PLUGIN_LOAD_TYPE_OUT_OF_PROC

Instructs the server to load the plug-in as an out-of-process object.

The following table identifies how the server loads a plug-in for various combinations of the relevant properties.

DefaultPlginLoadType

LoadType

UnsupportedLoadTypes

Plug-in loaded as:

Unspecified

Unspecified

Unspecified

In-process

Unspecified

Unspecified

In-process

Out-of-process

Unspecified

Unspecified

Out-of-process

In-process

In-process

Unspecified

Unspecified

In-process

In-process

Unspecified

In-process

Out-of-process

In-process

Unspecified

Out-of-process

In-process

Out-of-process

Unspecified

Unspecified

Out-of-process

Out-of-process

Unspecified

In-process

Out-of-process

Out-of-process

Unspecified

Out-of-process

In-process

n/a

In-process

Unspecified

In-process

n/a

In-process

Out-of-process

In-process

n/a

Out-of-process

Unspecified

Out-of-process

n/a

Out-of-process

In-process

Out-of-process

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)