IQueueCommand::InvokeAtStreamTime method (control.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The InvokeAtStreamTime method queues a method or property change for execution at a specified stream time (that is, presentation time relative to the current stream time offset).

Syntax

HRESULT InvokeAtStreamTime(
  [out]     IDeferredCommand **pCmd,
  [in]      REFTIME          time,
  [in]      GUID             *iid,
  [in]      long             dispidMethod,
  [in]      short            wFlags,
  [in]      long             cArgs,
  [in]      VARIANT          *pDispParams,
  [in, out] VARIANT          *pvarResult,
  [out]     short            *puArgErr
);

Parameters

[out] pCmd

Address of a variable that receives an IDeferredCommand interface pointer.

[in] time

Time at which to invoke the command.

[in] iid

Pointer to the interface identifier (IID) of interface.

[in] dispidMethod

Dispatch identifier (DISPID) of a method or property on the interface. Equivalent to the dispIdMember parameter of the IDispatch::Invoke method.

[in] wFlags

Flags describing the context of the call. Equivalent to the wFlags parameter of the IDispatch::Invoke method.

[in] cArgs

Number of arguments in pDispParams. Equivalent to the cArgs member of the DISPPARAMS structure.

[in] pDispParams

Pointer to an array that contains the arguments. Equivalent to the rgvarg member of the DISPPARAMS structure.

[in, out] pvarResult

Pointer to a VARIANT that receives the result. Equivalent to the pVarResult parameter of the IDispatch::Invoke method.

[out] puArgErr

Pointer to a variable that receives the index of the first argument that has an error. Equivalent to the puArgErr parameter of the IDispatch::Invoke method.

Return value

Returns an HRESULT value.

Remarks

Use the IDispatch::GetIDsOfNames method to retrieve the DISPID for the dispidMember parameter.

Examples

The following example queues an IMediaControl::Stop command for 3.0 seconds.


IQueueCommand *pQ = 0;
IMediaControl *pControl = 0;

// Query for IQueueCommand.
pGraph->QueryInterface(IID_IQueueCommand, reinterpret_cast<void**>(&pQ));

// Query for IMediaControl.
pGraph->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&pControl));

// Find the DISPID of the IMediaControl::Stop method.
OLECHAR *szMethod = OLESTR("Stop");

long dispid;
hr = pControl->GetIDsOfNames(IID_NULL, &szMethod, 1, 0, &dispid);

// Invoke the command.
IDeferredCommand *pCmd = 0;
hr = pQ->InvokeAtPresentationTime(&pCmd, 3.0,
    const_cast<GUID*>(&IID_IMediaControl), dispid, DISPATCH_METHOD, 
    0, 0, 0, 0);
if (SUCCEEDED(hr))
{
    pControl->Run();
    pCmd->Release();
}

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header control.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

IQueueCommand Interface