Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Delete method removes an IWMSCacheItemIWMSCacheItem Interface from the IWMSCacheItems collection.
HRESULT delete(
VARIANT varIndex
);
Arguments
varIndex |
[in] VARIANT that specifies the IWMSCacheItem interface to be removed from the collection. It can be an index or a pointer. |
Return Value
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code |
Number |
Description |
|---|---|---|
DISP_E_BADINDEX |
0x8002000B |
varIndex is not a valid index location. |
Example
#include <windows.h>
#include <atlbase.h> // Includes CComVariant.
#include "wmsserver.h"
// Declare variables and interfaces.
IWMSServer *pServer;
IWMSPlugins *pPlugins;
IWMSPlugin *pPlugin;
IWMSCacheProxyPlugin *pCacheProxyPlugin;
IWMSCacheItems *pCacheItems;
IWMSCacheItem *pCacheItem;
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
// that contains cache proxy plug-ins.
hr = pServer->get_CacheProxy(&pPlugins);
if (FAILED(hr)) goto EXIT;
hr = pPlugins->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// Retrieve the IWMSPlugin interface for the
// first cache proxy plug-in.
varIndex = 0;
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSCacheProxyPlugin interface.
hr = pPlugin->QueryInterface(IID_IWMSCacheProxyPlugin,
(void **)&pCacheProxyPlugin);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSCacheItems interface,
// and retrieve the count of cache items.
hr = pCacheProxyPlugin->get_CacheItems(&pCacheItems);
if (FAILED(hr)) goto EXIT;
hr = pCacheItems->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// Remove the first cache item.
varIndex = 0;
hr = pCacheProxyPlugin->Delete(varIndex);
if (FAILED(hr)) goto EXIT;
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.