Deferred commands are queued by calls to methods on the IQueueCommand interface and are exposed by the filter graph manager and by some filters. A successful call to one of these methods returns an IDeferredCommand interface representing the queued command.
A CDeferredCommand object represents a single deferred command and exposes the IDeferredCommand interface as well as other methods that permit time checks and actual execution. A CDeferredCommand object contains a reference to the CCmdQueue object on which it is queued.
Reference counts control the lifetime of the CDeferredCommand class. When calling the CDeferredCommand::Invoke member function, the calling application gets an interface pointer that is reference-counted, and the CCmdQueue object also holds a reference count on the deferred command. Calling the IDeferredCommand::Cancel member function takes the deferred command off the command queue and thus reduces the reference count by one. Once taken off the queue, the command cannot be put back on the queue.
m_bStream Flag for stream time or presentation time. to be passed to the invoked method. m_Dispatch Accesses the ITypeInfo interface. m_dispidMethod Method on the interface to run. m_DispParams CDispParams object containing the DISPPARAMS parameter list m_hrResult Stores the returned HRESULT value. m_iid Globally unique identifier (GUID) of the interface. m_pQueue Pointer to the CCmdQueue object that exposes the IQueueCommand interface. m_pUnk IUnknown pointer to the interface on which the command will be run. m_pvarResult Resulting information, if any, from the invoked method. m_time Time at which the command will be run. m_wFlags Flags specifying the context of the invocation.
CDeferredCommand Constructs a CDeferredCommand object. GetFlags Retrieves the context flags associated with the deferred command. GetIID Retrieves the interface identifier (IID) of the interface on which the method will be run. GetMethod Retrieves the dispatch identifier of the method to be run. GetParams Retrieves the DISPPARAMS argument list to the method. GetResult Retrieves the resulting argument list, if one exists. GetTime Retrieves the time when the method will be run. Invoke Provides access to methods and properties exposed by an object. IsStreamTime Specifies whether the command is to be run at stream time or presentation time.
Implemented IDeferredCommand Methods
Cancel Cancels a previously queued CDeferredCommand::Invoke request. Confidence Not currently implemented. Postpone Specifies a new presentation time for a previously queued command. GetHResult Retrieves the HRESULT value of the invoked method.
Implemented INonDelegatingUnknown Methods
NonDelegatingQueryInterface Retrieves a specified reference-counted interface.
Cancels a previously queued CDeferredCommand::Invoke request.
Syntax
HRESULT Cancel(void);
Return Value
Returns VFW_E_ALREADY_CANCELLED if m_pQueue is NULL. Returns an HRESULT from CCmdQueue::Remove if the call generates an error. Returns S_OK if successful.
Remarks
This member function implements the IDeferredCommand::Cancel method.
Constructs a CDeferredCommand object.
Syntax
CDeferredCommand( CCmdQueue *pQ, LPUNKNOWN pUnk, HRESULT *phr, LPUNKNOWN pUnkExecutor, REFTIME time, GUID *iid, long dispidMethod, short wFlags, long cArgs, VARIANT *pDispParams, VARIANT *pvarResult, short *puArgErr, BOOL bStream );
Parameters
- pQ
- Pointer to an object that exposes the IQueueCommand interface.
- pUnk
- Pointer to the outer IUnknown interface for aggregation.
- phr
- Pointer to a returned HRESULT value.
- pUnkExecutor
- Pointer to the object that will carry out this command.
- time
- Time at which the command will be run.
- iid
- Pointer to the globally unique identifier (GUID) of the interface that contains the method.
- dispidMethod
- Method on the interface to call.
- wFlags
- Context of the invocation.
- cArgs
- Number of arguments passed.
- pDispParams
- Pointer to a list of argument variant types.
- pvarResult
- Pointer to a returned variant type list, if any.
- puArgErr
- Pointer to the last argument in the pDispParams parameter list with an error.
- bStream
- Value indicating whether the deferred command time is in stream time (TRUE) or presentation time (FALSE).
Return Value
No return value.
This method is not currently implemented and returns E_NOTIMPL.
Syntax
HRESULT Confidence( LONG *pConfidence );
Parameters
- pConfidence
- Pointer to the confidence level.
Return Value
Returns E_NOTIMPL.
Remarks
For information about implementing this method, see IDeferredCommand::Confidence.
Retrieves the context flags associated with the deferred command.
Syntax
short GetFlags(void);
Return Value
The value retrieved will be one of the following:
DISPATCH_METHOD Run the member as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag can be set. DISPATCH_PROPERTYGET The member is being retrieved as a property or data member. DISPATCH_PROPERTYPUT The member is being changed as a property or data member. DISPATCH_PROPERTYPUTREF The member is being changed via a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object.
Retrieves the HRESULT value from the invoked command.
Syntax
HRESULT GetHResult( HRESULT *phrResult );
Parameters
- phrResult
- Pointer to the HRESULT value.
Return Value
Returns E_ABORT if m_pQueue is NULL. Otherwise, returns S_OK.
Remarks
This member function implements the IDeferredCommand::GetHResult method.
Retrieves the interface identifier (IID) of the interface on which the method will be run.
Syntax
REFIID GetIID(void);
Return Value
Returns the IID of the interface on which the method will be run.
Retrieves the dispatch identifier (DISPID) of the method to be run.
Syntax
long GetMethod(void);
Return Value
Returns the DISPID of the method to run.
Retrieves the DISPPARAMS argument list to the method.
Syntax
DISPPARAMS* GetParams(void);
Return Value
Returns a DISPPARAMS argument list.
Retrieves the resulting argument list, if one exists.
Syntax
VARIANT* GetResult(void);
Return Value
Returns a VARIANT containing the method's argument list, if it exists.
Retrieves the time at which the method will be run.
Syntax
CRefTime GetTime(void);
Return Value
Returns a CRefTime object containing a reference time.
Provides access to methods and properties exposed by an object.
Syntax
HRESULT Invoke(void);
Return Value
Returns VFW_E_ALREADY_CANCELLED if m_pQueue is NULL. Otherwise, returns the HRESULT resulting from a call to IDispatch::GetTypeInfo or IUnknown::QueryInterface.
Specifies whether the command is to be run at stream time or presentation time.
Syntax
BOOL IsStreamTime(void);
Return Value
Returns TRUE if set to stream time; otherwise, returns FALSE.
Retrieves a specified reference-counted interface.
Syntax
HRESULT NonDelegatingQueryInterface( REFIID riid, void **ppv );
Parameters
- riid
- Reference identifier.
- ppv
- Address of a pointer to the interface.
Return Value
Returns E_POINTER if ppv is invalid. Returns NOERROR if the query is successful or E_NOINTERFACE if it is not.
Remarks
Returns pointers to the IDeferredCommand and IUnknown interfaces by default. Override this method to publish any additional interfaces implemented by the derived class.
This member function implements the INonDelegatingUnknown::NonDelegatingQueryInterface method.
Specifies a new presentation time for a previously queued command.
Syntax
HRESULT Postpone( REFTIME newtime );
Parameters
- newtime
- New presentation time.
Return Value
Returns VFW_E_TIME_ALREADY_PASSED if newtime is already passed. Otherwise, returns an HRESULT resulting from a call to CCmdQueue::Remove (when extracting from the list) or CCmdQueue::Insert (when reinserting with the changed time).
Remarks
This member function implements the IDeferredCommand::Postpone method.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.