Metode IDirectorySearch::AbandonSearch (iads.h)
Metode IDirectorySearch::AbandonSearch meninggalkan pencarian yang dimulai oleh panggilan sebelumnya ke metode ExecuteSearch .
Sintaks
HRESULT AbandonSearch(
[in] ADS_SEARCH_HANDLE phSearchResult
);
Parameter
[in] phSearchResult
Menyediakan handel ke konteks pencarian.
Mengembalikan nilai
Metode ini mengembalikan nilai pengembalian standar, termasuk S_OK jika baris pertama berhasil diperoleh.
Untuk nilai pengembalian lainnya, lihat Kode Kesalahan ADSI.
Keterangan
IDirectorySearch::AbandonSearch dapat digunakan jika opsi Page_Size atau Asinkron dapat ditentukan melalui IDirectorySearch::SetSearchPreference sebelum pencarian dijalankan.
Contoh
LPWSTR pszAttr[] = { L"ADsPath", L"Name", L"samAccountName" };
ADS_SEARCH_HANDLE hSearch;
DWORD dwCount= sizeof(pszAttr)/sizeof(LPWSTR);
////////////////////////////////////////////////////////////////////
// NOTE: Assume that m_pSearch is an IDirectorySearch pointer to the
// object at the base of the search, and that the appropriate search
// preferences have been set.
// For brevity, omit error handling.
////////////////////////////////////////////////////////////////////
// Search for all users with a last name that starts with h.
hr = m_pSearch->ExecuteSearch(L"(&(objectClass=user)(sn=h*))", pszAttr, dwCount, &hSearch );
while( m_pSearch->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
{
// Get the samAccountName
hr = m_pSearch->GetColumn( hSearch, pszAttr[2], &col );
if ( FAILED(hr) )
{
hr = m_pSearch->AbandonSearch( hSearch );
hr = m_pSearch->CloseSearchHandle(hSearch);
m_pSearch->Release();
break;
}
if (col.dwADsType == ADSTYPE_CASE_IGNORE_STRING)
printf("%S\n", col.pADsValues->CaseIgnoreString);
m_pSearch->FreeColumn( &col );
}
m_pSearch->CloseSearchHandle( hSearch );
Persyaratan
Klien minimum yang didukung | Windows Vista |
Server minimum yang didukung | Windows Server 2008 |
Target Platform | Windows |
Header | iads.h |
DLL | Activeds.dll; Adsldp.dll; Adsldpc.dll |