hi all

I have two ap , how to open form when back to first ap?

now it can back message by handlemessagel.

some code as follows :

in AppUi:
void CMobilescanAppUi::StartTwo()
{
// twoconstants UID
const TInt KtwoUid = 0x20004FFE;
TUid id( TUid::Uid( KtwoUid ) );
TUid msgapid(TUid::Uid( _UID3 ));


TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );

if ( task.Exists() )
{
#if 1 //capabilities:SwEvent
_LIT8(params,""); //capabilities:SwEvent
task.SendMessage( msgapid, params); // Send a Uid to two that will callback.
task.BringToForeground();
#else
//Close two
EndTask(id,100);

//Launch two
HBufC* param = HBufC::NewLC( 256 );
param->Des().AppendNum(msgapid.iUid);
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
TThreadId idt;
appArcSession.StartDocument( *param, TUid::Uid( KtwoUid ), idt );
appArcSession.Close();
CleanupStack::PopAndDestroy(); // param
#endif

}else{

//Launch two
HBufC* param = HBufC::NewLC( 256 );
param->Des().AppendNum(msgapid.iUid);
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
TThreadId idt;
appArcSession.StartDocument( *param, TUid::Uid( KtwoUid ), idt );
appArcSession.Close();
CleanupStack::PopAndDestroy(); // param
}
}

TInt CMobilescanAppUi::EndTask(const TUid aUid, TUint32 aDelay)
{
TUint32 totalWait = 10000000; // 10 secs
TUint32 waitTime = 100000;
TUint32 elapsedTime = 0;

TInt endTask = 0;
TInt killed = 0;

do
{
TApaTaskList taskList(CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( aUid );

if (task.Exists())
{
if (endTask == 0)
{
task.EndTask();
endTask = 1;
}

User::After(waitTime);
elapsedTime += waitTime;
}
else if (endTask)
{
killed = 1;
User::After(aDelay);
break;
}

} while (elapsedTime < totalWait);

return killed;
}


MCoeMessageObserver::TMessageResponse CMobilescanAppUi::HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8 &aMessageParameters)
{
TBuf<1024> iResult;
iResult.Zero();

//convert UTF8 to UCS2
//The result from quickmark is encoded using UTF8.
CnvUtfConverter::ConvertToUnicodeFromUtf8(iResult,aMessageParameters);
iEikonEnv->InfoWinL( _L("Result"), iResult);

return MCoeMessageObserver::EMessageHandled;
}

in container:
TKeyResponse CMobilescanContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{.....
appui->StartTwo();
...