IWMSNamedValues Interface
Previous | Next |
IWMSNamedValues Interface
The IWMSNamedValues interface contains a collection of name-value pairs.
In addition to the methods inherited from IDispatch, the IWMSNamedValues interface exposes the following methods.
Method | Description |
Add | Adds an IWMSNamedValue interface to the IWMSNamedValues collection. |
get_Count | Retrieves the number of name-value pairs contained in the IWMSNamedValues collection. |
get_Item | Retrieves a name-value pair from the IWMSNamedValues collection. |
get_length | Retrieves the number of name-value pairs contained in the IWMSNamedValues collection. This method is provided for JScript compatibility. |
put_Item | Inserts or modifies a name-value pair in the IWMSNamedValues collection. |
Remove | Removes a name-value pair from the IWMSNamedValues collection. |
Example Code
The following example illustrates how to retrieve a pointer to an IWMSNamedValues interface.
#include <windows.h> #include "wmsserver.h" // Declare variables and interfaces. IWMSServer *pServer; IWMSNamedValues *pNamedValues; HRESULT hr; // 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 IWMSNamedValues interface // containing descriptive information about the server. hr = pServer->get_Properties(&pNamedValues); if (FAILED(hr)) goto EXIT;
System and custom plug-ins contain some default name-value pairs that can be accessed by simply indexing the name of the property you want to retrieve. For a list of the default values you can access, see Registering Plug-in Properties.
The following example illustrates how to retrieve one of the default configuration values.
// Declare variables and interfaces. IWMSServer *pServer; IWMSPlugins *pPlugins; IWMSPlugin *pPlugin; IWMSNamedValues *pNamedValues; IWMSNamedValue *pNamedValue; HRESULT hr; CComVariant varIndex; CComVariant varValue; // Retrieve a pointer to an IWMSPlugins interface // containing event-handler plug-ins. hr = pServer->get_EventHandlers(&pPlugins); if (FAILED(hr)) goto EXIT; // Retrieve a pointer to an IWMSPlugin interface. varIndex = "WMS IP Address Authorization"; hr = pPlugins->get_Item(varIndex, &pPlugin); if (FAILED(hr)) goto EXIT; // Retrieve a pointer to an IWMSNamedValues interface // containing descriptive information about the plug-in. hr = pPlugin->get_Properties(&pNamedValues); if (FAILED(hr)) goto EXIT; // Retrieve the default name-value pair // describing the plug-in copyright. varIndex = "Copyright"; hr = pNamedValues->get_Item(varIndex, &pNamedValue); if (FAILED(hr)) goto EXIT; // Retrieve the value associated with this pair. hr = pNamedValue->get_Value(&varValue); if (FAILED(hr)) goto EXIT; EXIT: // TODO: Release temporary COM objects and uninitialize COM.
See Also
Previous | Next |