进度条对话框类为:CAknProgressDialog
头文件:aknprogressdialog.h
lib: avkon.lib eikcdlg.lib eikctl.lib
使用方法:
Code:
//初始化进度条
CAknProgressDialog* iProgressDialog;
CEikProgressInfo* iProgressInfo;
iProgressDialog = new ( ELeave ) CAknProgressDialog( reinterpret_cast
<CEikDialog**>
( &iProgressDialog ) );
iProgressDialog->SetCallback( this );
iProgressDialog->PrepareLC( R_RESOURCE_PROGRESS_NOTE ); //从资源文件构造对话框,资源见下面的定义
iProgressInfo = iProgressDialog->GetProgressInfoL();
iProgressInfo->SetFinalValue( aMaxValue ); //设置进度条的最大值(结束值)
iProgressDialog->RunLD();
//更新进度条
iProgressInfo->IncrementAndDraw( aStep );
//结束进度条
iProgressDialog->ProcessFinishedL();
delete iProgressDialog;
RESOURCE DIALOG R_RESOURCE_PROGRESS_NOTE //进度条对话框资源
{
flags = EAknProgressNoteFlags;
buttons = R_AVKON_SOFTKEYS_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtNote;
id = EMagicBoxCtrlIdProgressNote;
control = AVKON_NOTE
{
layout = EProgressLayout;
singular_label = "对话框中显示的文字";
plural_label = "download";
imagefile = AVKON_BMPFILE_NAME; //第二版中 图标文件为 #define AVKON_BMPFILE_NAME "z://system//data//avkon.mbm"
imageid = EMbmAvkonQgn_note_sml; //这两项可更改显示不同图标
imagemask = EMbmAvkonQgn_note_sml_mask;
};
}
};
}