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.
Protected Data Members
Name | Description |
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_time | Time at which the command will be run. |
m_iid | Globally unique identifier (GUID) of the interface. |
m_dispidMethod | Method on the interface to run. |
m_wFlags | Flags specifying the context of the invocation. |
m_pvarResult | Resulting information, if any, from the invoked method. |
m_bStream | Flag for stream time or presentation time. |
m_DispParams | CDispParams object containing the DISPPARAMS parameter list to be passed to the invoked method. |
m_Dispatch | Accesses the ITypeInfo interface. |
m_hrResult | Stores the returned HRESULT value. |
Member Functions
Name | Description |
CDeferredCommand | Constructs a CDeferredCommand object. |
GetFlags | Returns the context flags associated with the deferred command. |
GetIID | Returns the interface identifier (IID) of the interface on which the method will be run. |
GetMethod | Returns the dispatch identifier of the method to be run. |
GetParams | Returns the DISPPARAMS argument list to the method. |
GetResult | Returns the resulting argument list, if one exists. |
GetTime | Returns 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
Name | Description |
Cancel | Cancels a previously queued CDeferredCommand::Invoke request. |
Confidence | Returns a confidence value that describes the probability of the deferred command being run on time. |
Postpone | Specifies a new presentation time for a previously queued command. |
GetHResult | Returns the HRESULT value of the invoked method. |
Implemented INonDelegatingUnknown Methods
Name | Description |
NonDelegatingQueryInterface | Returns a specified reference-counted interface. |
Cancels a previously queued CDeferredCommand::Invoke request.
HRESULT Cancel( );
Returns an HRESULT value.
This member function implements the IDeferredCommand::Cancel method.
Constructs a CDeferredCommand object.
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
);
No return value.
Retrieves a confidence value on a scale of 0 to 100 that describes the probability that the deferred command will be run on time.
HRESULT Confidence(
LONG *pConfidence
);
Returns an HRESULT value.
Higher confidence values indicate a greater probability of timely execution. For example, a command queued at a presentation time that has already passed will return a value of 0. A value of 100 would indicate, with absolute certainty, that the command can be run on time.
This member function implements the IDeferredCommand::Confidence method.
Returns the context flags associated with the deferred command.
short GetFlags( );
The value retrieved will be one of the following.
Value | Description |
DISPATCH_METHOD | Run the member as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag may 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. |
Returns the HRESULT value from the invoked command.
HRESULT GetHResult(
HRESULT* phrResult
);
Returns an HRESULT value.
This member function implements the IDeferredCommand::GetHResult method.
Retrieves the interface identifier (IID) of the interface on which the method will be run.
REFIID GetIID( );
Retrieves the dispatch identifier of the method to be run.
long GetMethod( );
Retrieves the DISPPARAMS argument list to the method.
DISPPARAMS* GetParams( );
Retrieves the resulting argument list, if one exists.
VARIANT* GetResult( );
Returns the time at which the method will be run.
CRefTime GetTime( );
Returns a CRefTime object containing a reference time.
Provides access to methods and properties exposed by an object.
HRESULT Invoke( );
Returns an HRESULT value.
Specifies whether the command is to be run at stream time or presentation time.
BOOL IsStreamTime( );
Returns TRUE if set to stream time; otherwise, returns FALSE.
Returns a specified reference-counted interface.
HRESULT NonDelegatingQueryInterface(
REFIID riid,
void **ppv
);
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.
HRESULT Postpone(
REFTIME newtime
);
Returns an HRESULT value.
This member function implements the IDeferredCommand::Postpone method.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.