Platform SDK: DirectX

IDirectMusicGetLoader::GetLoader

The IDirectMusicGetLoader::GetLoader method retrieves a pointer to the loader object that created the stream.

HRESULT GetLoader(
  IDirectMusicLoader ** ppLoader
);

Parameters

ppLoader
Address of a variable to receive the IDirectMusicLoader interface pointer. The reference count of the interface is incremented.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return E_NOINTERFACE.

Remarks

The following code example is from a file parser that finds a reference to an object that needs to be accessed by the loader.

HRESULT myGetReferencedObject(
    DMUS_OBJECTDESC *pDesc,          // Descriptor already prepared
    IStream *pIStream,               // Stream being parsed
    IDirectMusicObject **ppIObject)  // Object to be accessed
{
    IDirectMusicGetLoader *pIGetLoader;
    IDirectMusicLoader *pILoader;
    ppIObject = NULL;
    HRESULT hr = pIStream->QueryInterface(
           IID_IDirectMusicGetLoader,
           (void **) &pIGetLoader );
    if (SUCCEEDED(hr))
    {
        hr = pIGetLoader->GetLoader(&pILoader);
        if (SUCCEEDED(hr))
        {
            hr = pILoader->GetObject(pDesc, IID_DirectMusicLoader,
                  (void**) ppIObject);
            pILoader->Release();
        }
        pIGetLoader->Release();
    }
    return hr;
}

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusici.h.

See Also

Custom Loading