Platform SDK: Active Directory, ADSI, and Directory Services |
The IDirectory::CloseSearchHandle method closes the handle to a search result and frees the associated memory.
HRESULT CloseSearchHandle( ADS_SEARCH_HANDLE hSearchHandle );
This method returns the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
The process that implements the IDirectorySearch::CloseSearchHandle method must also be responsible for freeing all memory allocated by the IDirectorySearch::ExecuteSearch method, including the search result and the search result handle.
The caller may call this method only once for each opened search handle and must use the IDirectorySearch::ExecuteSearch method to obtain a new search handle after issuing IDirectorySearch::CloseSearchHandle.
ADS_SEARCH_HANDLE hSearch; HRESULT hr; hr = m_pSearch->ExecuteSearch(L"(&(objectCategory=user)(l=Redmond))", pszAttr, dwCount, &hSearch ); if ( SUCCEEDED(hr) ) { // Omit getting the data m_pSearch->CloseSearchHandle(hSearch); }
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.
IDirectorySearch, IDirectorySearch::ExecuteSearch, ADSI Error Codes