HRESULT IResourceManagerFactory::Create(GUID *Guid, CHAR *NomRessource, IResourceManagerSink *pIResourceManagerSink, IResourceManager **pIResourceManager);
Le résultat est rangé dans pIResourceManager.
#include <transact.h>
#include <txdtc.h>
#include <xolehlp.h>
static IResourceManagerSink *pIResourceManagerSink;
static ITransactionDispenser *pITransactionDispenser;
static IResourceManagerFactory::Create *pIResourceManagerFactory;
static IResourceManager *pIResourceManager;
static GUID Guid;
..
if (pITransactionDispenser->QueryInterface(IID_IResourceManagerFactory, (void **)&pIResourceManagerFactory::Create)!=S_OK)
{
...
}
...
pIResourceManagerFactory->AddRef();
...
if (CoCreateGuid(&Guid)!=S_OK)
{
...
}
...
if (pIResourceManagerFactory->Create(&Guid, "UpsOms", pIResourceManagerSink, &pIResourceManager)!=S_OK)
{
...
}
...
pIResourceManager->AddRef();
...
pIResourceManager->Release();
...
pIResourceManagerFactory->Release();
...