I need open an application from my application, but I don't know UID, so I used this:

_LIT(KCaptionName,"Application_Name");
TBuf<KApaMaxAppCaption> caption(KCaptionName);

TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp(caption);
if ( task.Exists() )
{
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(_L("Application Exist"));
}
else
{
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(_L("App UNINSTALLED"));
}

the application exist, but this code tell me that app is uninstalled. I print the caption in a file and it is in the file.

Then I write this code, but the problem is te same:


_LIT8(KCaptionName,"Application_Name");
TBuf8<KApaMaxAppCaption> capt(KCaptionName);

RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect());
appArcSession.GetAllApps();

TBuf<KApaMaxAppCaption> cap;
TApaAppInfo info;

while(appArcSession.GetNextApp(info))
{
cap = info.iCaption;
TBuf8 <KApaMaxAppCaption> cap8;
cap8.Copy (cap);

if(cap8.Compare(capt) == 0)
{
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(_L("App OK"));
break;
}
}
appArcSession.Close();

Who helps me? Thanks a lot in advance.
Loredana