| Platform SDK: Active Directory, ADSI, and Directory Services |
The following code fragment binds to an object with the name Bob in the Microsoft.com domain using ADsGetObject, which uses the caller's security context:
Dim myUser as IADs
Set myUser = GetObject("LDAP://CN=Bob,DC=Microsoft,DC=com")
IADs *pObject;
HRESULT hr;
hr = ADsGetObject(L"LDAP://CN=Bob,DC=Microsoft,DC=com",
IID_IADs,
(void**) &pObject);