Share via


Setting the Loader's Search Directory

By default, the loader looks for objects in the current directory unless a full path is specified in the wszFileName member of the DMUS_OBJECTDESC structure describing the object being sought. By using the IDirectMusicLoader8::SetSearchDirectory method, you can set a different default path for the IDirectMusicLoader8::GetObject and IDirectMusicLoader8::EnumObject methods. This default path can apply to all objects, or only to objects of a certain class.

The behavior of IDirectMusicLoader8::LoadObjectFromFile is somewhat different. See the Remarks for that method.

The following example function sets the search path for style files:

HRESULT mySetLoaderPath (IDirectMusicLoader8 *pILoader)
{
  return pILoader->SetSearchDirectory(
      CLSID_DirectMusicStyle,
      L"c:\\mymusic\\rock",
      FALSE);
}

After calling this function, the application can load a style by file name, without including the full path.

© 2004 Microsoft Corporation. All rights reserved.