Microsoft DirectX 9.0


The OpenFile method opens and automatically creates a filter graph for the specified media file. If DirectShow doesn't support the file format, this method does nothing.


  LPCWSTR pszFileName,
  DWORD dwFlags



[in] Pointer to the name of the file you want to open.


[in] Value that modifies how the filter graph will render the specified file. This value is a combination of one or more of the following flags.

Value Description
AMMSF_NOCLOCK Run the stream with no clock.
AMMSF_NORENDER Open the file, but do not render any streams. This flag should always be accompanied with the AMMSF_RUN flag.
AMMSF_RENDERALLSTREAMS Render all streams, including those that do not have an existing media stream.
AMMSF_RENDERTOEXISTING Only render to existing streams.
AMMSF_RUN Set the stream into the run state.

Return Values

Returns one of the following values.

Return code Description
E_INVALIDARG The dwFlags parameter is invalid.
E_POINTER This method tried to access an invalid pointer.
S_OK Success.


The AMMSF_RENDERALLSTREAMS flag will create default rendering filters for video and audio if they do not exist. However, these default filters cannot be accessed by the IStreamSample::GetMediaStream method.

See Also