Microsoft DirectX 9.0 |
The ScanDirectory method searches a directory or disk for all files of a specified class type and file name extension. For each file found, it calls the IDirectMusicObject8::ParseDescriptor method to extract the GUID and name of the object. This information is stored in an internal database. After a directory has been scanned, all files of the requested type become available for enumeration through the IDirectMusicLoader8::EnumObject method; in addition, an object can be retrieved by using IDirectMusicLoader8::GetObject, even without a file name.
Syntax
HRESULT ScanDirectory(
REFGUID rguidClass,
WCHAR* pwzFileExtension,
WCHAR* pwzScanFileName
);
Parameters
rguidClass
Reference to (C++) or address of (C) the identifier of the class of objects. For a list of standard loadable classes, see IDirectMusicLoader8.
pwzFileExtension
File name extension for the type of file to look for. Use L"*" to look in files with any or no extension. (See Remarks.)
pwzScanFileName
Name of a file to use for cached file information. This file is created by the first call to ScanDirectory and used by subsequent calls. Pass NULL if a cache file is not wanted.
Return Values
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 error values shown in the following table.
Return code |
DMUS_E_NOT_FOUND |
E_FAIL |
E_OUTOFMEMORY |
E_POINTER |
REGDB_E_CLASSNOTREG |
Remarks
The IDirectMusicLoader8::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. After it has been 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).
GUID_DirectMusicAllTypes is not a valid value for rguidClass.
If the file type has more than one possible extension, call ScanDirectory once for each file name extension.
Requirements
Header: Declared in dmusici.h.
See Also