Platform SDK: Active Directory, ADSI, and Directory Services

IDsBrowseDomainTree

The IDsBrowseDomainTree interface enumerates and/or displays a list of trust domains related to a given computer. If no computer is specified, the interface handles the trust domains of the local computer.

This interface is defined in dsclient.h, implemented in the DsDomainTreeBrowser class, and distributed in dsuiext.dll. To use the interface, you must first create an instance of the DsDomainTreeBrowser object class:

#include <objbase.h>
#define INITGUID
#include <initguid.h>
#include "dsclient.h"
 
LPWSTR target;
IDsBrowseDomainTree *pDSB;
CoInitialize(NULL);
HRESULT hr = CoCreateInstance(CLSID_DsDomainTreeBrowser,
                           NULL,
                           CLSCTX_INPROC_SERVER,
                           IID_IDsBrowseDomainTree,
                           (void**)&pDSB);
 
// specify computer and credentials for retrieving domain information.
hr = pDSB->SetComputer(L"myMachine", L"user", L"passwd")
 
// bring up a domain browser against "myMachine" and the given credentials.
hr = pDSB->BrowseTo(GetTopDeskWindow(),&target, DBDTF_RETURNFQDN);
 
// Retrieve trust domains of "myMachine":
// Can be any of the following: DOMAIN_TREE domains; DOMAINTREE 
//domains; PDOMAINTREE domains; LPDOMAINTREE domains;
//PDOMAINTREE domains.
hr = pDSB->GetDomains(&domains, DBDTF_RETURNFQDN);
 
// Flush internal cache before retargeting to a different machine:
hr = pDSB->FlushCachedDomains();
hr = pDSB->SetComputer(L"yourComputer", L"admin", L"passwd");
hr = pDSB->GetDomains(&domains, DBDTF_RETURNFQDN);
 
// Frees domains
pDSB->FreeDomains(&domains);
 
pDSB->Release();
CoUninitialize();

Methods in Vtable Order

IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IDsBrowseDomainTree Methods Description
BrowseTo Displays domain browse dialog
GetDomains Retrieves a list of trust domains.
FreeDomains Frees the domain list.
FlushCachedDomains Frees the cached domain list.
SetComputer Specifies the computer and credentials.

Remarks

This interface uses the DOMAINTREE structure to store the domain description (DOMAINDESC) about the retrieved domains. The domains can be displayed in various formats as defined by the DBDTF_* constants.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Dsclient.h.
  Library: Included as a resource in Dsuiext.dll.

See Also

Active Directory Display Interfaces, DOMAINDESC, DOMAINTREE, ICommonQuery, IDsDisplaySpecifier, IPersistQuery, IQueryForm