GetDocDisplayValues methods
This method is intended for use with C/C++.
- Method
- short GetDocDisplayValues(
- long Index,
- IUnknown * pValues,
- short MaxValues )
- Parameters
- Index
- Specifies the zero-based index of a document within the document list of the active folder.
- pValues
- Points to an array of ArsOleValues to receive the values of the folder display fields for the document specified with Index. There are the same number of values as there are display fields. The array must have at least MaxValues elements.
- MaxValues
- Specifies the maximum number of values to be returned.
- Description
- The values of the folder display fields for the document, up to
a maximum of MaxValues, are returned in pValues.
Each name is a null-terminated character string.
The values are placed in the array in the same sequence that the display field names are returned by the GetFolderDisplayFieldNames method.
GetDocDisplayValue or GetDocDisplayValues can be used to retrieve the document display values. An application should use the one which is more convenient in its environment.
- Return Value
- Refer to return codes.
- See Also
- GetNumDocsInList, GetNumFolderDisplayFields, GetDocDisplayValue, and OpenDoc methods
C/C + +
The following example creates a list box of the folder document list names and associated values and opens the document selected by a user. 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;
.
.