IDirectorySearch::CloseSearchHandle method

The IDirectorySearch::CloseSearchHandle method closes the handle to a search result and frees the associated memory.

Syntax


HRESULT CloseSearchHandle(
  [in] ADS_SEARCH_HANDLE hSearchHandle
);

Parameters

hSearchHandle [in]

Provides a handle to the search result to be closed.

Return value

This method returns the standard return values, as well as the following:

For other return values, see ADSI Error Codes.

S_OK

The search result was closed.

E_ADS_BAD_PARAMETER

The search handle is invalid.

Remarks

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.

Examples


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);
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Iads.h

DLL

Activeds.dll;
Adsldp.dll;
Adsldpc.dll

IID

IID_IDirectorySearch is defined as 109BA8EC-92F0-11D0-A790-00C04FD8D5A8

See also

IDirectorySearch
IDirectorySearch::ExecuteSearch
ADSI Error Codes

 

 

Show: