GetNumFolders method
The number of folders available for the current server is returned in the specified variable.
- Method
- short GetNumFolders(
- Parameters
- pNumFolders
- Points to a variable to receive the number of folders available for the current server. On return, this variable is set to type VT_I2.
- Description
- This value can be used with the GetFolderNames method to prepare for opening a folder.
- Return Value
- Refer to return codes.
- See Also
- GetFolderNames and OpenFolder methods
C/C + +
The following example retrieves the names of all folders available for the current server, puts them in a ComboBox control, retrieves the chosen folder, and performs an open for that folder. CArsOle * pArsCtrl;
ArsOleName * pFolderNames;
CComboBox * pFoldersList;
char folder[ sizeof( ArsOleName ) ];
short rc, j, num_folders;
int index;
VARIANT vari;
.
.
// During dialog initialization:
rc = pArsCtrl->GetNumFolders( &vari );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
num_folders = var.iVal;
pFolderNames = new ArsOleName[ max( num_folders, 1 ) ];
rc = pArsCtrl->GetFolderNames( (IUnknown*)pFolderNames, num_folders );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
for ( j = 0; j < num_folders; j++ )
index = pFoldersList->AddString( pFolderNames[j] );
pFoldersList->SetCurSel( 0 );
.
.
// During OK button processing:
pFoldersList->GetWindowText( folder, sizeof(folder) );
rc = pArsCtrl->OpenFolder( folder );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
.
.
Visual Basic
Dim rc, count As Integer
Dim num_folders As Variant
Dim Temp As String
.
.
rc = ArsOle.GetNumFolders (num_folders)
If rc <> ARS_OLE_RC_SUCCESS Then
MsgBox "ERROR"
End
End If
ReDim FolderNames(num_folders -1)
For count = 0 To num_folders -1
rc = ArsOle.GetFolderName(count, Temp)
lbFolders.AddItem Temp
Next count
.
.
' During OK button processing
rc = ArsOle.OpenFolder (lbFolders.List(lbFolders.ListItem))
If rc <> ARS_OLE_RC_SUCCESS Then
MsgBox "ERROR"
End
End If