Conversion en PB
Publié : jeu. 29/juil./2010 14:21
Bonjour,
j'ai besoin de faire une interogation sur l'active directory, et j'aurai besoin d'aide pour convertir le code suivant en purebasic.
Merci par avance
j'ai besoin de faire une interogation sur l'active directory, et j'aurai besoin d'aide pour convertir le code suivant en purebasic.
Code : Tout sélectionner
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;