Microsoft DirectX 9.0

IQueueCommand::InvokeAtStreamTime

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(
  IDeferredCommand **pCmd,
  REFTIME time,
  GUID *iid,
  long dispidMember,
  short wFlags,
  long cArgs,
  VARIANT *pDispParams,
  VARIANT *pvarResult,
  short *puArgErr
);

Parameters

pCmd

[out] Address of a variable that receives an IDeferredCommand interface pointer.

time

[in] Time at which to invoke the command.

iid

[in] Pointer to the interface identifier (IID) of interface.

dispidMember

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

wFlags

[in] Flags describing the context of the call. Equivalent to the wFlags parameter of the IDispatch::InvokeAt method.

cArgs

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

pDispParams

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

pvarResult

[in, out] Pointer to a VARIANT that receives the result. Equivalent to the pVarResult parameter of the IDispatch::InvokeAt method.

puArgErr

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

Return Value

Returns an HRESULT value.

Remarks

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

Example Code

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();
}

See Also