程序思路:利用AO监控来电状态,来电时,启动指定程序A,在程序A中设置了程序CCoeEnv::Static()->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);,在程序A中视图container中构建了一个poplist对话框,代码如下: poplist对话框代码: void CStreamerCtrlAppContainer::ShowSoundPopupListL() { CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); // Create popup list and PUSH it. CAknPopupList* popupList = CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_MENU_LIST, AknPopupLayouts::EMenuWindow); CleanupStack::PushL(popupList); // initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); MDesCArray* itemList = list->Model()->ItemTextArray(); CDesCArray* items = (CDesCArray*) itemList; TBuf<128> filename; RFs iSessionRFs; CDir* dirList; _LIT(KStringSize,"%S"); User::LeaveIfError(iSessionRFs.Connect()); TBuf<128> dPath; TBuf<128> dPathF; if( !BaflUtils::FileExists(iSessionRFs, KPrivateFolderPath1)) { User::LeaveIfError(iSessionRFs.MkDir(KPrivateFolderPath1)); } dPathF.Format( KPrivateFolderPath1, &dPath ); User::LeaveIfError(iSessionRFs.GetDir(dPathF, KEntryAttMaskSupported, ESortByName, dirList)); TInt j = dirList->Count(); for (TInt i = 0;i<j;i++) { filename.Format(KStringSize,&(*dirList)[i].iName); if(SoundVomL(filename)) { items->AppendL(filename); } } delete dirList; iSessionRFs.Close(); // Show popup list and then show return value.(在Fp1平台执行下面这步时程序退出) TInt popupOk = popupList->ExecuteLD(); CleanupStack::Pop(popupList); //If the user enters ok on a selection if (popupOk) { //Do what you have to do TBuf<128> tempItem; TBuf<128> textItem; TPtrC16 sourceRow; TInt endPos = 0; if (list->Model()->NumberOfItems()) { tempItem.Copy(list->Model()->ItemText(list->CurrentItemIndex())); //tempItem.Copy(model->ItemText(list->CurrentItemIndex())); sourceRow.Set(tempItem); endPos = sourceRow.Length(); textItem.Append(sourceRow.Mid(0,endPos)); CleanupStack::PopAndDestroy(list); DataSaveL( textItem ); STATIC_CAST(CStreamerCtrlAppUi*,iAvkonAppUi)->ExitApp() ; } else { CleanupStack::PopAndDestroy(list); STATIC_CAST(CStreamerCtrlAppUi*,iAvkonAppUi)->ExitApp() ; } } else { CleanupStack::PopAndDestroy(list); STATIC_CAST(CStreamerCtrlAppUi*,iAvkonAppUi)->ExitApp() ; } } 程序运行效果: FP1平台手机:来电时,启动了A程序,但是执行到contianer的poplist代码(TInt popupOk = popupList->ExecuteLD();)这步时,程序A退出。 Mr平台手机:一切正常,没有问题。来电时,启动了A程序,弹出poplist对话框,选择后来电正常运行。 FP1和Mr平台在这步程序代码上有区别么,有什么安全规则么? 谢谢! 本帖最后由 techcore 于 2010-7-30 11:13 编辑 最好看一下错误编码,装一个这个Err.sis ErrRd.zip (1.82 KB) 。装完Err.sis后,你再跑一下那个程序,应该能捕获到错误号。 http://wiki.forum.nokia.com/index.php/Extended_panic_code 来电时,运行到这行代码时TInt popupOk = popupList->ExecuteLD();,程序运行提示“程序已关闭 KERN-EXE-3”。Fp1平台上,DRAPD都没有获得返回值就弹出错误了;Mr上正常(popupOk =1或0)。 这是LD没有销毁问题,但是我这是Popuplist对话框,需要构建啊,Fp1上怎么就出错了(mr上正常)。 各位指点一下。谢谢!
|