IXMLDOMDocument::get_implementation

banner art

Previous Next

IXMLDOMDocument::get_implementation

The get_implementation method retrieves a pointer to an IXMLDOMImplementation interface for the document.

Syntax

  HRESULT get_implementation(
 IXMLDOMImplementation** ppImpl
);

Parameters

ppImpl

[out] Pointer to a pointer to an IXMLDOMImplementation interface for this document. This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.

Return Values

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

Remarks

An XML DOM application can use objects from multiple implementations. This method provides access to a pointer to an IXMLDOMImplementation interface that handles this document.

Example Code

The following example retrieves a pointer to an IXMLDOMImplementation interface.

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

// Declare variables.
IWMSServer*             pServer;
IXMLDOMDocument*        pPlaylist;
IXMLDOMImplementation*  pXMLImp;

HRESULT                 hr;
CComBSTR                bstrFeature;
CComBSTR                bstrVersion;
CComVariant             varFile;
VARIANT_BOOL            bIsSuccessful;
VARIANT_BOOL            bHasFeature;

// 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;

// Create the playlist object.
hr = pServer->CreatePlaylist(&pPlaylist);

// Load a sample playlist file.
varFile = "c:\\wmpub\\wmroot\\simple.wsx";
hr = pPlaylist->load(varFile, &bIsSuccessful);
if (FAILED(hr)) goto EXIT;

if (bIsSuccessful)
{
    //Retrieve a pointer to an IXMLImplementation interface. 
    hr = pPlaylist->get_implementation(&pXMLImp);
    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