Microsoft DirectX 8.1 (C++)

IDirectMusicGetLoader8::GetLoader

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

Syntax

HRESULT GetLoader8(
  IDirectMusicLoader ** ppLoader
);

Parameters

ppLoader

Address of a variable that receives the IDirectMusicLoader interface pointer. Use QueryInterface to obtain IDirectMusicLoader8. 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

  Header: Declared in dmusici.h.

See Also