How to run the file with the default application
Article Metadata
Headers
#include <apacmdln.h>
#include <apgcli.h>
#include <apgtask.h>
#include <w32std.h>
Running a File with the default application
// Starts the default application for the passed file and runs the file in it.
/*
*@param aFileLocation :- File to be Launched by corresponding default application.
*/
void MySystemClass::LaunchDefaultApp( const TDesC& aFileLocation )
{
RApaLsSession applicationSession;
TUid Uid;
TDataType currentdataType;
RFs file;
RWsSession windowSession;
TThreadId currentthreadId;
file.Connect();
applicationSession.Connect();
applicationSession.GetAllApps();
applicationSession.AppForDocument(aFileLocation ,Uid,currentdataType);
windowSession.Connect();
TApaTaskList apataskList(windowSession);
TApaTask apatask = apataskList.FindApp( Uid );
applicationSession.StartDocument(aFileLocation ,Uid,currentthreadId);
applicationSession.Close();
file.Close();
windowSession.Close();
}


The example as a generic title but a particular use case. It is not clear how would this example help me "run" a JPEG file with the default JPEG handler application.
ltomuta 23:08, 20 November 2007 (EET)