IWMSPublishingPoints::Clone
Previous | Next |
IWMSPublishingPoints::Clone
The Clone method creates a duplicate instance of a specific IWMSPublishingPoint interface.
Syntax
HRESULT Clone( BSTR szDestName, IWMSPublishingPoint* pSrcPubPt, IWMSPublishingPoint** ppDestPubPt );
Parameters
szDestName
[in] BSTR containing the name of a publishing point to be duplicated. The maximum length for this string is 250 characters.
pSrcPubPt
[in] Pointer to the IWMSPublishingPoint interface to copy.
ppDestPubPt
[out] Pointer to a pointer to the duplicate IWMSPublishingPoint interface.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Number | Description |
E_POINTER | 0x80004003 | Indicates that pVal is a NULL pointer argument. |
NS_E_DUPLICATE_NAME | 0xC00D0036L | Indicates that pVal is already being used by another publishing point. |
NS_E_INVALID_PUBLISHING_POINT_NAME | 0xC00D1455L | Indicates that pVal contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127. |
NS_E_NAMESPACE_NAME_TOO_LONG | 0xC00D1392L | Indicates that pVal is longer than the maximum length allowed. |
NS_E_PUBLISHING_POINT_REMOVED | 0xC00D145AL | Indicates that the publishing point has already been removed. |
Remarks
When a publishing point is cloned, properties of plug-ins on the new publishing point may need to be adjusted to avoid conflicts. For example, when cloning a broadcast publishing point on which a multicast data sink plug-in is enabled, values such as the multicast address will need to be changed if the multicast data sink IP address is specified manually. In addition, all plug-ins that were enabled on the publishing point that was cloned will also be enabled on the cloned publishing point. All plug-ins in the cloned publishing point that have the WMS_PLUGIN_REMOVE_ON_SERVICE_RESTART flag set in their Status property will not show up in the new publishing point.
This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.
Example Code
#include <windows.h> #include <atlbase.h> // Includes CComBSTR. #include "wmsserver.h" // Declare variables and interfaces. IWMSServer *pServer; IWMSPublishingPoints *pPubPoints; IWMSPublishingPoint *pPubPoint; IWMSPublishingPoint *pNewPubPoint; HRESULT hr; CComBSTR bstrName; CComBSTR bstrPath; // 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 the IWMSPublishingPoints interface. hr = pServer->get_PublishingPoints(&pPubPoints); if (FAILED(hr)) goto EXIT; // Add a new publishing point to the server. bstrName = "New Pub Point"; bstrPath = "c:\\wmpub\\wmroot\\"; hr = pPubPoints->Add(bstrName, WMS_PUBLISHING_POINT_BROADCAST bstrPath, &pPubPoint); if (FAILED(hr)) goto EXIT; // Clone the newly added publishing point. // Note: Plug-ins must be re-enabled on the clone. bstrName = "Cloned Pub Point"; hr = pPubPoints->Clone(bstrName, pPubPoint, &pNewPubPoint); 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.
See Also
Previous | Next |