GetFolderDisplayFieldNames method
This method is intended for use with C/C++.
- Method
- short GetFolderDisplayFieldNames(
- Parameters
- pNames
- Points to an array of ArsOleNames to receive the names of the display 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 display fields for the active folder, up to a
maximum of MaxNames, are returned in pNames.
Each name is a null-terminated character string.
GetFolderDisplayFieldName or GetNumFolderDisplayFields can be used to retrieve the folder display field names. An application should use the one which is more convenient in its environment.
- Return Value
- Refer to return codes for an explanation of the return code.
- See Also
- GetNumFolderDisplayFields, and GetFolderDisplayFieldName
- Example
- The following example creates a list box of the folder document list names and associated values and opens the document selected by a user.
C/C + +
CArsOle * pArsCtrl;
ArsOleName * pNames;
ArsOleValue * pValues;
CListBox * pDocList;
char * pLine;
short rc, k, opr, num_fields;
long j, num_docs;
int size;
VARIANT vari;
.
.
// During dialog initialization:
rc = pArsCtrl->GetNumFolderDisplayFields( &vari );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
num_fields = var.iVal;
.
.
.
.
pNames = new ArsOleName[ max( num_fields, 1 ) ];
rc = pArsCtrl->GetFolderDisplayFieldNames( (IUnknown*)pNames, num_fields );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
rc = pArsCtrl->GetnumDocsInList( &vari );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
num_docs = var.lVal;
pValues = new ArsOleValue[ max( num_fields, 1 ) ];
size = num_fields * ( sizeof(ArsOleName) + sizeof(ArsOleValue) + 5 );
pLine = new char[ size ];
for ( j = 0, pLine[0] = '\0'; j < num_docs; j++ )
{
rc = pArsCtrl->GetDocDisplayValues( j, pValues, num_fields );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
for ( k = 0; k < num_fields; k++ )
{
strcat( pLine, pNames[k] );
strcat( pLine, " = " );
strcat( pLine, pValues[k] );
if ( k < num_fields - 1 )
strcat( pLine, ", " );
}
pDocList->InsertString( -1, pLine );
}
pDocList->SetCurSel( 0 );
.
.
// During OK button processing:
rc = pArsCtrl->OpenDoc( (long)pDocList->GetCurSel( ) , NULL, 0 );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
.
.