GetFolderSearchFieldNames method
This method is intended for use with C/C++.
- Method
- short GetFolderSearchFieldNames(
- Parameters
- pNames
- Points to an array of ArsOleNamess to receive the names of the search fields for the active folder. The array must have at least MaxNames elements.
- MaxNames
- Specifies the maximum number of names to be returned.
- Description
- The names of the search fields for the active folder, up to a
maximum of MaxNames, are returned in pNames.
Each name is a null-terminated character string.
GetFolderSearchFieldName or GetFolderSearchFieldNames can be used to retrieve the folder search field names. An application should use the one which is more convenient in its environment.
- Return Value
- Refer to return codes.
- See Also
- GetNumFolderSearchFields, GetFolderSearchFieldName, SetFolderSearchFieldData, and SearchFolder methods
C/C + +
The following example retrieves the names of the active folder search fields, gives a user the opportunity to set the values for these fields, and initiates a search of the folder. CArsOle * pArsCtrl;
ArsOleName * pNames;
CListBox * pFieldList, * pOprList;
CEdit * pValue1, * pValue2;
char name[ sizeof( ArsOleName ) ];
char value1[ sizeof( ArsOleValue ) ];
char value2[ sizeof( ArsOleValue ) ];
short rc, j, opr, num_fields;
VARIANT vari;
.
.
struct _OprMap
{
short code;
char * pText;
} OprMap
.
.
.
.
static OprMap Oprs[] =
{ { ARS_OLE_OPR_EQUAL, "Equal" },
{ ARS_OLE_OPR_NOT_EQUAL, "Not Equal" },
.
.
{ ARS_OLE_OPR_LIKE, "Like" },
{ ARS_OLE_OPR_NOT_LIKE, "Not Like" } };
#define NUM_OPRS ( sizeof(Oprs) / sizeof(OprMap) )
// During dialog initialization:
rc = pArsCtrl->GetNumFolderSearchFields( &vari );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
num_fields = var.iVal;
pNames = new ArsOleName[ max( num_fields, 1 ) ];
rc = pArsCtrl->GetFolderSearchFieldNames( (IUnknown*)pNames, num_fields );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
for ( j = 0; j < num_fields; j++ )
pFieldList->InsertString( -1, pNames[j] );
pFieldList->SetCurSel( 0 );
for ( j = 0; j < NUM_OPRS; j++ )
{
pOprList->InsertString( -1, Oprs[j].pText );
pOprList->SetItemData( j, (DWORD)Oprs[j].code );
}
pOprList->SetCurSel( 0 );
.
.
.
.
// During SET FIELD button processing:
pFieldList->GetText( pFieldList->GetCurSel( ), name );
opr = (short)pOprList->GetItemData( pOprList->GetCurSel( ) );
pValue1->GetWindowText( value1, sizeof(value1) );
pValue2->GetWindowText( value2, sizeof(value2) );
rc = pArsCtrl->SetFolderSearchFieldData( name, opr, value1, value2 );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
.
.
// During OK button processing:
rc = pArsCtrl->SearchFolder( FALSE );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
.
.