Microsoft DirectX 8.1 (C++) |
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 code example sets the search path for style files:
HRESULT mySetLoaderPath (
IDirectMusicLoader8 *pILoader) // Previously created.
{
return pILoader->SetSearchDirectory(
CLSID_DirectMusicStyle,
L"c:\\mymusic\\funky",
FALSE);
}
After calling this function, the application can load a style by file name, without including the full path.