IWMSPlugin::put_LoadType

The put_LoadType method specifies a value determining how the server should load this plug-in.

HRESULT put_LoadType(
  WMS_PLUGIN_LOAD_TYPE  val
);

Arguments

val

[in] Member of a WMS_PLUGIN_LOAD_TYPE enumeration type indicating how a plug-in is loaded. This must be 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

The plug-in is loaded as an in-process object.

WMS_PLUGIN_LOAD_TYPE_OUT_OF_PROC

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

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code

Number

Description

NS_E_UNSUPPORTED_LOAD_TYPE

0xC00D1453L

The load type indicated by val is not supported by the plug-in.

Remarks

If you set this property to WMS_PLUGIN_LOAD_TYPE_UNSPECIFIED, the server loads plug-ins as in-process objects. However, if the UnsupportedLoadType property of a plug-in specifies that it cannot be loaded in-process, the plug-in will be loaded out-of-process.

Example

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlugins     *pPlugins;
IWMSPlugin      *pPlugin;

HRESULT         hr;
CComVariant     varIndex;
long            lCount;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlugins interface
// and retrieve the total count of plug-ins.
hr = pServer->get_CacheProxy(&pPlugins);
if (FAILED(hr)) goto EXIT;
hr = pPlugins->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Retrieve information about each plug-in.
for (long x = 0; x < lCount; x++)
{
    varIndex = x;
    hr = pPlugins->get_Item(varIndex, &pPlugin);
    if (FAILED(hr)) goto EXIT;

    // Retrieve the plug-in load type.
    WMS_PLUGIN_LOAD_TYPE ltLoadType;
    hr = pPlugin->get_LoadType(&ltLoadType);
    if (FAILED(hr)) goto EXIT;
    if (ltLoadType != WMS_PLUGIN_LOAD_TYPE_UNSPECIFIED)
        hr = pPlugin->put_LoadType(WMS_PLUGIN_LOAD_TYPE_UNSPECIFIED);
        if (FAILED(hr)) goto EXIT;

    // Release temporary COM objects.
    pPlugin->Release();
}

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Header: wmsserver.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Reference

IWMSPlugin Interface