Microsoft DirectX 9.0


The SetSourceNameValidation method specifies how the render engine validates file names.


HRESULT SetSourceNameValidation(
    BSTR FilterString,
    IMediaLocator *pOverride,
    LONG Flags



BSTR value 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 presents an Open File dialog box to the end user.


Optional pointer to the IMediaLocator interface of a media locator to use in place of the default. To use the default media locator, set the value of this parameter to NULL. See Remarks for more information.


Bitwise combination of File Name Validation Flags specifying the behavior of the media locator. The SFN_VALIDATEF_CHECK flag must be present. The SFN_VALIDATEF_IGNOREMUTED flag has no effect with this method.

Return Value

Returns one of the following HRESULT values:

Value Description
S_OK Success.
E_MUST_INIT_RENDERER Render engine failed to initialize.


Using the pOverride parameter, you can supply your own custom implementation of the IMediaLocator interface. For example, the default media locator does not notify an application about the files that it finds (or cannot find). To get around this limitation, you could implement a custom media locator, making it a wrapper for the default version. Then pass IMediaLocator::FindMediaFile calls directly to the default version and examine the return value.

Currently, this method does not validate dynamically loaded sources. See IRenderEngine::SetDynamicReconnectLevel.


Header: Include Qedit.h. This header file is not compatible with Microsoft® Direct3D® headers later than version 7.

Library: Use strmiids.lib.

See Also