Archived:Setting a default drive and directory for AknCommonDialogs
Article Metadata
Compatibility
S60 3rd Edition
Article
Overview
Setting a default drive and directory for AknCommonDialogs
Description
The following code example shows how the AknCommonDialogs class can be used to select the directories from a particular drive.
Solution
In the resources, declare the memory selection dialog as follows:
RESOURCE MEMORYSELECTIONDIALOG r_memory_selection_dialog
{
title = "title string";
softkey_1 = "ok string";
softkey_2 = "cancel string";
locations =
{
LOCATION
{
\\ Replace <drive> with - c: for phone, e: for memory card
\\ Replace <dir> with default directory
root_path = "<drive>:\\";
default_folder = "<drive>:\\<dir>";
}
};
}
// In the cpp file, launch the AknCommonDialogs. RunSaveDlgLD() does not display the folder selection dialog - instead, the resulting path will be constructed from the root and default folder read from resources.
LIT(filename ,"default"); // default file name to display in dialog
TBuf<32> default_file_name;
default_file_name.Copy(filename);
AknCommonDialogs::RunSaveDlgLD(default_file_name, R_MEMORY_SELECTION_DIALOG);


Heuven - AknCommonDialogs is deprecated - use AknCommonDialogsDynMem instead!
AknCommonDialogs is deprecated. It is recommended to use AknCommonDialogsDynMem instead. See http://library.developer.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6/html/Common_File_Dialogs_APIClassesIndexPage.html.heuven 10:56, 7 March 2012 (EET)