OpenFolder method
If pFolderName is non-NULL and points to a string other than an empty string, the named folder is opened.
- Method
- short OpenFolder(
- Parameters
- pFolderName
- Points to a null-terminated character string containing the name of the folder.
- Description
-
If pFolderName is NULL or points to an empty string, the normal Content Manager OnDemand Open Folder dialog box is displayed. The user can then select the folder and complete the open.
The opened folder becomes the active folder. The Content Manager OnDemand Folder dialog box is initially hidden. It can be displayed by using the ShowFolder method.
- Return Value
- Refer to return codes.
- See Also
- GetNumFolders, GetFolderNames, CloseFolder, and CloseAllFolders 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
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