Microsoft DirectX 8.1 (C++) |
The MediaLocator.FindMediaFile method searches for a file and, if successful, retrieves the path to the file.
Syntax
object.FindMediaFile(
Input As String,
FilterString As String,
pOutput As String,
Flags As Long
)
Parameters
Input
File name, including path, where the file was last known to reside. For source objects in the timeline, use the current media name.
FilterString
String containing pairs of filter strings formatted as required by the lpstrFilter member of the Microsoft® Win32® OPENFILENAME structure. The media locator uses this filter if it displays an Open dialog box.
pOutput
Variable that receives the actual path to the file, if it differs from the value contained in Input and if the method successfully locates the file.
Flags
Bitwise combination of zero or more of the following flags, from the File Name Validation Flags:
Error Codes
If the method fails, an error is raised, and Err.Number can be set to one of the following values:
Value | Description |
E_FAIL | Failure. |
E_INVALIDARG | Argument is invalid. |
E_POINTER | NULL pointer argument. |
Remarks
If the SFN_VALIDATEF_POPUP flag is specified and the media locator cannot locate the file, this method displays an Open dialog box for the user to locate the file. If the user cancels the dialog box, the method raises an E_FAIL error. Your application should catch this error using an On Error statement:
If Err.Number = &H80004005 Then
' Did not locate the file.
End If
If the SFN_VALIDATEF_POPUP flag is not specified, and the media locator cannot locate the file, the method raises an E_FAIL error without displaying the dialog box.
The filter string for the Open dialog box, which is specified by the FilterString parameter, contains internal Null characters. For example, Video\0*.avi\0\0
. You can use Chr(0) to specify the Null characters:
sNullStr = Chr(0)
sFilterStr = "Video" + sNullStr + "*.avi" + sNullStr + sNullStr
See Also