IHolder::TrackResource method (comsvcs.h)
Tracks the resource.
Syntax
HRESULT TrackResource(
[in] const RESID __MIDL__IHolder0003
);
Parameters
[in] __MIDL__IHolder0003
The handle of the resource to be tracked. The Resource Dispenser has already created this resource before calling TrackResource.
Return value
This method can return the following values.
Return code | Description |
---|---|
|
The method completed successfully. |
|
ResId is not a valid resource handle. |
|
The method failed. The resource has not been tracked. The likely cause is that the caller's transaction is aborting. |
Remarks
Some resources are not kept in inventory; they are always manufactured on demand. The Holder is used only as a mechanism to automatically free the resources left at the end of an object's lifetime.
TrackResource tells the Holder that a resource should be tracked until it is freed by calling IHolder::UntrackResource, or until the object that called TrackResource is released, at which time the Dispenser Manager automatically frees the resource.
If TrackResource is called from a transactional object, it calls back to the Resource Dispenser's IDispenserDriver::EnlistResource method. The EnlistResource method can enlist the resource in the transaction, or it can return S_FALSE, indicating that the resource is not transaction capable and has not been enlisted.
This resource is eventually destroyed after both of the following are true:
- The Resource Dispenser calls IHolder::UntrackResource (most likely at the component's request), or the object's lifetime ends.
- The transaction that the resource was enlisted in (if any) is done.
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 | comsvcs.h |