## IResourceConsumer Interface

The IResourceConsumer interface implements a resource consumer that requests resources from a resource manager that supports the IResourceManager interface.

When to Implement

Implement this interface on any object that requests resources from a resource manager. (The filter graph manager acts as a resource manager for Microsoft® DirectShow™.) After implementing this interface, the object can register resources that it wants to use. It passes a pointer to this interface when it does this so that the resource manager can use methods on this interface to inform the object that a resource is available, or to release a resource that it is using.

When to Use

A resource manager that implements the IResourceManager interface calls methods on this interface.

Methods in Vtable Order

IUnknown methods | Description
QueryInterface | Returns pointers to supported interfaces.
AddRef | Increments the reference count.
Release | Decrements the reference count.

IResourceManager methods | Description
AcquireResource | Notifies the resource consumer that a resource might be acquired.
ReleaseResource | Requests the resource consumer to release the specified resource.

###

IResourceConsumer::AcquireResource

IResourceConsumer Interface

Notifies the resource consumer that a resource might be acquired.

HRESULT AcquireResource(
LONG idResource
);

##### Parameters

idResource
  [in] Resource identifier of the resource to be acquired.

##### Return Values

Returns one of the following values.

Value | Meaning
S_OK | Consumer has successfully acquired the resource.
S_FALSE | Consumer has not acquired the resource but will use IResourceManager::NotifyAcquire when it does.
VFW_S_RESOURCE_NOT_NEEDED | Consumer no longer needs the resource.
Error Value | Consumer tried to acquire the resource but failed.

###

IResourceConsumer::ReleaseResource

IResourceConsumer Interface

Requests the resource consumer to release the specified resource.

HRESULT ReleaseResource(
LONG idResource
);

##### Parameters

idResource
  [in] Resource identifier to be released.

##### Return Values

Returns S_OK if the consumer has released it and requires it again when it becomes available, or S_FALSE if the consumer has not released it but will use IResourceManager::NotifyRelease when it does.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.