| Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsPathname::GetNumElements method gets the number of elements in the path.
HRESULT IADsPathname::GetNumElements( DWORD * dwNumPathElements );
This method supports the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
The following Visual Basic® code snippet shows how to use GenNumElements.
dim x As New Pathname x.Set = "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL y = x.GetNumElements() ' y = 3.
The following VBScript code snippet shows how to use GenNumElements.
dim x
Const ADS_SETTYPE_FULL = 1
Set x = CreateObject("Pathname")
x.Set = "LDAP://srv1/dc=dom,dc=company,dc=com",ADS_SETTYPE_FULL
y = x.GetNumElements() ' y = 3.
The following C++ code snippet prints out all the number of elements of a path. See the code snippet in IADsPathname for the GetPathnameObject function.
LPWSTR adsPath=L"LDAP://server/cn=jsmith,dc=Microsoft,dc=com";
IADsPathname *pPath = GetPathnameObject(adsPath);
long count=0;
HRESULT hr = pPath->GetNumElements(&count);
printf("Count = %d\n",count);
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.