COM Vtable Examples - Creating a User Object

IADsContainer *pContainer;
IADs     *pNewObject;
IADsUser *pUser;
 
//
// Bind to the known container.
//
ADsGetObject(TEXT("WinNT://Mydomain"),
             IID_IADsContainer,
             (void**)&pContainer);
//
// Create the new wrapper.
//
pContainer->Create(TEXT("user"),
                   TEXT("Jane"),
                   &pNewObject);
//
// Get the IADsUser interface from the wrapper.
//
pNewObject->QueryInterface(IID_IADsUser, &pUser);
//
// Write it back to the DS.
//
pUser->SetInfo();
//
// Set Jane's password.
//
pUser ->SetPassword(TEXT("PW.1234"));
//
// Cleanup.
//
pContainer->Release();
pNewObject->Release();
pUser->Release();