DirectX SDK |
The IDirectMusicLoader::ScanDirectory method searches a directory on disk for all files of a requested class type and file extension. For each file found, it calls the IDirectMusicObject::ParseDescriptor method to extract the GUID and name of the object. This information is stored in an internal database. Once a directory has been scanned, all files of the requested type become available for enumeration through the IDirectMusicLoader::EnumObject method; in addition, an object can be retrieved by using IDirectMusicLoader::GetObject, even without a file name.
HRESULT ScanDirectory( REFGUID rguidClass, WCHAR* pwzFileExtension, WCHAR* pwzScanFileName );
If the method succeeds, the return value is S_OK, or S_FALSE if no files were found.
If it fails, the method can return one of the following error values:
DMUS_E_NOT_FOUND |
E_FAIL |
E_OUTOFMEMORY |
E_POINTER |
REGDB_E_CLASSNOTREG |
The IDirectMusicLoader::SetSearchDirectory method must be called first to set the location to search.
The scanned information can be stored in a cache file defined by pwzScanFileName. Once it has been so stored, subsequent calls to ScanDirectory are much quicker because only files that have changed are scanned (the cache file stores the file size and date for each object, so it can tell if a file has changed).
If the file type has more than one extension, call ScanDirectory once for each file extension.
GUID_DirectMusicAllTypes is not a valid value for rguidClass.
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.