IDispenserManager::RegisterDispenser method (comsvcs.h)

Registers the resource dispenser with the dispenser manager.


HRESULT RegisterDispenser(
  [in]  IDispenserDriver *__MIDL__IDispenserManager0000,
  [in]  LPCOLESTR        szDispenserName,
  [out] IHolder          **__MIDL__IDispenserManager0001


[in] __MIDL__IDispenserManager0000

The IDispenserDriver interface the Resource Dispenser offers to the Dispenser Manager to use later to notify the Resource Dispenser.

[in] szDispenserName

A friendly name of the Resource Dispenser for administrator display.

[out] __MIDL__IDispenserManager0001

The IHolder interface that has been instantiated for the resource dispenser.

Return value

If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.


The Resource Dispenser notifies the Dispenser Manager that it has started and is prepared to accept notifications on this IDispenserDriver interface. Then the Dispenser Manager creates the Holder for this new Resource Dispenser and returns it to the Resource Dispenser.

This method does not call AddRef on the pDispenserDriver object, but IHolder::Close does perform a Release on pDispenserDriver. This can cause the Resource Dispenser object to be destroyed prematurely. To prevent this premature destruction, the caller of IDispenserManager::RegisterDispenser must explicitly call AddRef on the pDispenserDriver object.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header comsvcs.h

See also