convert in PB
Posted: Thu Jul 29, 2010 2:19 pm
Hello
I need to make interogation on active directory, and I need help to convert the following code in purebasic
Thanks you
I need to make interogation on active directory, and I need help to convert the following code in purebasic
Code: Select all
IADs *pobjADs; // Pointer to object interface
BSTR bstrName; // String with object name
HRESULT hResult; // COM result code
// String to directory service
WCHAR *pstrADsPath = "LDAP://ldap.itd.umich.edu/O=University of Michigan,C=us";
// Initalize COM
CoInitialize ( NULL );
// Get pointer to object's IADs interface
hResult = ADsGetObject( pstrADsPath, IID_IADs, (void**) &pobjADs);
// Check for success
if ( SUCCEEDED ( hResult ) )
{
// Get the Name property from the object
hResult = pobjADs->get_Name ( &bstrName );
// Check for success
if ( SUCCEEDED ( hResult ) )
{
// Display Name property
// (must use wide strings when working with COM)
wcout << "The name of the object found is: << bstrName << endl;
}
else
{
wcerr << L"Error occured while getting the object name: " << hResult << endl;
}
// When finished with the interface, call the
// Release method to free object
pobjADs->Release ();
}
else
{
wcerr << L"Error occured while getting the object: " << hResult << endl;
}
// Unload COM
CoUninitialize ();
// Return the result of any failures
return hResult;