如何开发nokia手机中的特定目录?
具体是这样的,比如我左键option菜单,里面有一项是 "打开C盘的music文件夹 ",当我选择后,屏幕立刻就显示这个文件里的所有内容.不知哪位大哥能贴出代码?或者讲讲流程.
------解决方案--------------------------------------------------------
一段有用的代码,遍历指定文件夹下的文件夹和文件
_LIT(iSkinFileDir, "C:\\system\\midlets\\ ");
CDirScan* ds = CDirScan::NewLC(iCoeEnv-> FsSession());
TRAPD(err,ds-> SetScanDataL(iSkinFileDir,KEntryAttNormal,ESortByName|EAscending,CDirScan::EScanDownTree));
if (err!=KErrNone)
{
CleanupStack::PopAndDestroy(ds);
return;
}
CDir* c = NULL;
TFileName fullname;
while(1)
{
ds-> NextL(c);
if (!c)
break;
for (TInt i=0; i <c-> Count(); i++)
{
const TEntry e= (*c)[i];
fullname.Copy(ds-> FullPath());
fullname.Append(e.iName);
RLog::Log(fullname);
TParsePtrC p(fullname);
}
delete c;
c=NULL;
}
CleanupStack::PopAndDestroy(ds);
------解决方案--------------------------------------------------------
也许这个是你想要的
资源文件
打开文件对话框
RESOURCE MEMORYSELECTIONDIALOG r_memory_selection_dialog
{
title = "Choose memory: ";
softkey_1 = "Accept ";
softkey_2 = "Negative ";
locations =
{
LOCATION { root_path = "C:\\Nokia\\ "; }, //指定的文件夹,比如C:\\Nokia\\Music
LOCATION { root_path = "E:\\ "; }
};
}
要打开的文件格式,下面是列出所有mp3文件
RESOURCE FILESELECTIONDIALOG r_file_selection_dialog
{
title= "Select Mp3 to open ";
filters=
{
FILTER
{
filter_data={ "*.mp3 "};
}
};
}
在点击菜单时执行下面这段
TFileName fileToOpen;
if( !AknCommonDialogs::RunSelectDlgLD(fileToOpen,
R_MEMORY_SELECTION_DIALOG, R_FILE_SELECTION_DIALOG) )
{
return;
}