Starting APP and EXE applications

in
Keywords:

There is two kind of native applications in a Symbian system:
-  APP are the applications that have a GUI and therefore are visible from the end-user
-  EXE are generally server or command-line application that generally run hidden since they have no GUI and cannot be directly launched from the main menu.

 

Manual Launch

If you are a end-user and want to start an APP : it will be listed in the menu of your phone if it is properly installed [1]

Launching an EXE cannot be done directly since an EXE application will not be visible from the main menu and trying to launch if from the Inbox (where it may be stored if you download it over IrDA or Bluetooth) will cause a security error. First you will need to install a File Explorer like application (like FileMan or FExplorer), browse to the location where it is saved (the inbox directory is C:\system\Mail\xxx on my 3650), and then run it.

 

Program launch

Starting programmatically an APP or EXE file is very simple once you know which API to use.

To start an EXE application:

 #include <EikDll.h>
 ...
 _LIT(KMyAppName, "c:\\system\\Apps\\MyApp\\MyApp.exe");
 EikDll::StartExeL(KMyAppName);

The code to start an APP is slightly more complex but allow to specify a document name:

 #include <EikDll.h>
 #include <apacmdln.h>
 ...
 _LIT(KMyAppName, "c:\\system\\Apps\\MyApp\\MyApp.app");
 _LIT(KMyDocName, "c:\\Documents\\MyApp.dat");
 
 CApaCommandLine * cmd=CApaCommandLine::NewL();       
 cmd->SetLibraryNameL(KMyAppName);       
 cmd->SetDocumentNameL(KMyDocName);
 cmd->SetCommandL(EApaCommandRun);
 EikDll::StartAppL(*cmd);

 

Launching Browser or other Nokia applications

If you intend to start ROM based Series 60 application, it may be worth to take a look at the Utilizing External Application Views document on Forum Nokia.

The following code (taken from the document above) will start the browser on a specified page:

#include <apgcli.h> // apgrfx.lib

void NNewLCUtils::StartBrowser(const TDesC& aUrl)
{
HBufC* param = HBufC::NewLC( 256 );
param->Des().Format( _L( "4 %S" ),&aUrl );

// Wap Browser's constants UId
const TInt KWmlBrowserUid = 0x10008D39;
TUid id( TUid::Uid( KWmlBrowserUid ) );

TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
     HBufC8* param8 = HBufC8::NewLC( param->Length() );
     param8->Des().Append( *param );
     task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
     CleanupStack::PopAndDestroy(); // param8
}
else
{
     RApaLsSession appArcSession;
     User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
     TThreadId id;
     appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid ), id );
     appArcSession.Close();
}
CleanupStack::PopAndDestroy(); // param
}

[1] The two main reason that can make your APP not visible are:
-  a bad UID : the UID you use for your application is already used by anothe one present on your phone. Check here if you want to learn more on about to solve this
-  a bad directory name: your application shall be stored in a directory that has the same name as you app file, ex: c:\system\apps\myApp\myApp.app


> Starting APP and EXE applications

I try to lauch the EXE in the same way as as you descripted, (PATH is C:/System/Mail/xxx. I still got the error message "Unable execute file for security reasons"

> Starting APP and EXE applications

Hi,

I have a small problem with icon associating with exe. Can somebody help me in this regard. My exe program has UI framework generated at runtime. It is not console based application. But when i am seeing the Tasklist of running applications i see a default icon associated with it. But i want to change it to my own icon. So can i change that icon at runtime????

Regards Giri

> Starting APP and EXE applications

Hi,

This doesn't seems to work on the new Nokia 6630! If someone has an idea how to do "EikDll:RunAppInsideThread" on this device it would be very helpfull for me!

> Starting APP and EXE applications: User 23 Panic

Hello to all. I have a strange and arandom panic when i launch the browser from a my application . This error is Application close Browser User 23. I use this code: const TInt KWmlBrowserUid = 0x10008D39; TUid id(TUid::Uid( KWmlBrowserUid )); HBufC* iParam = iDocument.LoadHTTPGetData(); TInt len = iDocument.iResponseAddress.Length() + iParam->Length(); HBufC* url = HBufC::NewLC(len); TPtr urlPtr = url->Des(); TBuf <256> iAdd; iAdd.Copy(iDocument.iResponseAddress); urlPtr.Copy(iAdd); urlPtr += iParam->Des(); delete iParam; iFile.Write(_L8("Dopo la delete")); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(TUid::Uid( KWmlBrowserUid )); TBuf8<256> iAddress; iAddress.Copy(*url); TInt StartDocumentCheck = KErrNone; if (task.Exists()) HBufC8* param8 = HBufC8::NewLC(url->Length()); param8->Des().Append(*url); task.SendMessage(TUid::Uid(0), *param8); // Uid is not used CleanupStack::PopAndDestroy(); // param8 else RApaLsSession appArcSession; User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server TThreadId id2; StartDocumentCheck = appArcSession.StartDocument( *url, TUid::Uid( KWmlBrowserUid ), id2 ); if(StartDocumentCheck== KErrNotFound) CAknInformationNote* informationNote = new (ELeave)CAknInformationNote; informationNote->ExecuteLD(_L("Impossibile attivare il browser")); appArcSession.Close(); CleanupStack::PopAndDestroy(); // url return StartDocumentCheck;

I log each step of this function so I can read that the function exit correctly, without error. But the browser is closed with the above panic message. It's a random error that comes up when I restart IIS web server. I hope to have been clearful Thanks in advance. RdA

> Starting APP and EXE applications

Eric,

It took me a while, but I was able to find a simple way to have .EXE files show up on the shell, and run them.

I just want a little credit for this, so here it goes:

"When building the .PKG file, you can install an EXE on the shell, by simply copying/renaming the .EXE file to an .APP file on the device. Like this:

[Excerpt from .PKG file] ; Install and run a server... "\Symbian\...\hello.exe" - "!:\system\apps\hello.APP",FILERUN, RUNINSTALL

This is what I did, and it worked for me. I have done this on a Nokia 6620, and the Sony Ericson P900

> Can .exe be a GUI?

hai Eric, is there any way to create a GUI application as .exe file instead of .app? Thanks.

> Starting APP and EXE applications

Hi,

I'm new to Symbian. I need to launch a .exe from .app. I tried to use EikDll::StartExeL(KExeName). The exe file is in the same directory as .app. So i assign the full name, such as "c:\system\apps\myapp\myexe.exe", to KExeName. But it didn't work for me. I got "system error".Did I miss something? If I need to pass command line parameters to the .exe, should I just put them into KExeName like this:"c:\system\apps\myapp\myexe.exe p1 p2"?

Thanks for your help,

Shirley

APPINST FOR UIQ??

I use the following code succesfully to start a .sis file downloaded from the internet on series60 :

cmdLine->SetLibraryNameL(_L("z:\\System\\apps\\appinst\\appinst.app")); cmdLine->SetDocumentNameL(installName);//((TDesC)iPluginName); cmdLine->SetCommandL(EApaCommandRun); EikDll::StartAppL(*cmdLine); Now i need something similar to start a sis in UIQ, but it seems APPINST is not the right system application to do that . I found a QAPPINST , that has the effect to start an UNINSTALLER with the code above , so if there is someone that knows how to correctly use it (or if is'nt QAPPINST , another app) please let me know :) Thanks for your attention

> APPINST FOR UIQ??

Hi

I had a same problem earlier with QAppInst.app. I hope you will get the results if you put these lines in your code

{{
cmdLine->SetTailEndL(_L8("INSTALL"));
cmdLine->SetCommandL(EApaCommandOpen);
RApaLsSession ls;
TInt err = ls.Connect();
CleanupClosePushL(ls);
if(err == KErrNone)
ls.StartApp(*cmdLine);
CleanupStack::PopAndDestroy(2); /* ls, cmdLine */
}}

> Starting APP and EXE applications

Eric

Thanks for you great help your article made my life easy :).

I tried this to browser and control panel it works fine, Now I'm trying it to install .SIS package through running "qappinst.app" with in my application, it works fine when I tap to application icon,but it smiply ignors the peace of code when I use FILERUN, RUNINSTALL parameter with app file in .PKG file. this seems quite reasonable because another installer instance is already running. is there any way I can run another instance of installer while its already rinning

or

It will install embedded SIS and embedded SIS package wont get Uninstalled when I unistall my application.

Any help any clue will be much appriciated

Rgds

> Starting APP and EXE applications

Hi eric, I want to send a url like https://samples/download when I am trying to send this url it is not opening the page, can you please suggest what changes do I need to do in the code for sending a http url

> Starting APP and EXE applications

hi eric, ur code was very helpful. i have tried the app method.Whats my problem is - for eg if u take the Calculator example, the app name is calc.app where as its application name in the launcher is specifeid as calculator. if a new application is installed i have to go & find out if the name specifed in the launcher and its .app name are same or not. its tedious as i want to make the whole process user interactive. that is the user will specify the name of the application to be invoked. in that case i cant expect the user to know if the applications name in the launcher is exactly its .app name. how to go about this?

> Starting APP and EXE applications

Dear Eric: I have some trouble to lunch Some P800 P900 system Applications (Dictionary,internet,picture....) Frist time to launch those application is OK!! But, After launching the other application in the same way,I can't launch them (Dictionary,internet,picture....) again!! Could you give me some idea!!!! Thanks!!!

> Starting APP and EXE applications

Hi Eric,

Thanks for a wonderful article. Can u please tell me if its possible to launch an application when an SMS is received(something similar to PushRegistry in J2mE).

> Starting APP and EXE applications

Hi!

Very interesting article!

Do you think it's possible to start a java MIDlet with this technique?

Hugo Maurício