Archived:How to launch an Exe and pass command line arguments
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Headers required:
#include <f32file.h>
#include <apgcli.h>
#include <apacmdln.h>
Library needed:
LIBRARY efsrv.lib
LIBRARY apgrfx.lib
LIBRARY apparc.lib
Source:
_LIT(KAppPath, "c:\\system\\apps\\appname\\myapp.app");
_LIT(KParameters, "somearguments");
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
TFindFile file(fs);
User::LeaveIfError(file.FindByDir(KAppPath,KNullDesC));
RApaLsSession ls;
User::LeaveIfError(ls.Connect());
CleanupClosePushL(ls);
CApaCommandLine *cmd = CApaCommandLine::NewLC();
cmd->SetLibraryNameL(file.File());
// Passing parameters //
cmd->SetTailEndL(KParameters);
cmd->SetCommandL(EApaCommandRun);
User::LeaveIfError(ls.StartApp(*cmd));
CleanupStack::PopAndDestroy(3);
Internal Links:
- How to Launch Browser in 3rd edition
- How to get ReDraw event in exe from window server?
- How to capture Keyevents in thread or exe
- How to use graphics in a non-GUI Symbian exe
- How to start EXE from an EXE in 3rd Edition
- How do you parse command line arguments in a non-view-based Symbian app
- Archived:Launching a new file in an existing app instance


03 Sep
2009
How do you access the parameters from the launched application? My 3rd edition, view-based program doesn't get the parameters in CCommandLineArguments. Fredrik Eldh 15:12, 10 August 2007 (UTC)
Since the above post is of 2007, developers facing the same problem might like to refer to this [1] thread.
--kamalakshan 18:43, 3 September 2009 (UTC)