| Platform SDK: Active Directory, ADSI, and Directory Services |
The IDirectorySearch::GetPreviousRow method gets the previous row of the search result. If the provider does not provide cursor support, it should return E_NOTIMPL.
HRESULT GetPreviousRow( ADS_SEARCH_HANDLE hSearchHandle );
This method returns the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
When the ADS_SEARCHPREF_CACHE_RESULTS flag is not set, only forward scrolling is permitted, because the client might not cache all the query results.
hr = m_pSearch->ExecuteSearch(L"(&(objectCategory=user)(st=WA))", pszAttr, dwCount, &hSearch );
if ( SUCCEEDED(hr) )
{
while( m_pSearch->GetNextRow(hSearch) != S_ADS_NOMORE_ROWS )
{
/* Get the data */
}
// Print it backward
hr = m_pSearch->GetPreviousRow( hSearch );
while( hr != S_ADS_NOMORE_ROWS && hr != E_NOTIMPL)
{
/* Get 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.