Symbian3rd bandParametersStartProcess
Author:Cding
Time:
The call with parameters in s60v2 is relatively simple. The buf8 or filename parameters can be obtained through the openfile mode. The latest s60 3rd/uiq3.1 is added to the security check, in this way, all calls to open files are blocked and can be used only after the swevent capability is added:
Add:
Capability swevent
Test code:
1. Startapp method call:
Capacommandline * cmd = capacommandline: newlc ();
CMD-> setcommandl (eapacommandrun );
CMD->Setexecutablenamel(_ L ("helloworld.exe "));
CMD-> setdocumentnamel (_ L ("x.txt "));
Rapalssession als;
User: leaveiferror (ALS. Connect ());
Cleanupclosepushl (ALS );
User: leaveiferror (ALS. Startapp (* cmd ));
Cleanupstack: popanddestroy (2 );
2. startdocument
Rapalssession als;
Tthreadid ID;
Tuid uid;
UID. iuid = 0xe0001001;
ALS. Connect ();
ALS. startdocument (_ L ("yourdocument.txt"), uid, ID );
ALS. Close ();
3. pprocess
Rprocess * process = new rprocess ();
Tuidtype uidtype (knulluid );
Process-> Create (_ L ("// sys/bin // helloworld.exe"), _ L ("teststring"), uidtype );
Process-> resume ();
Process-> close ();
Delete process;
4. tfindprocess
_ Register (kprocessname, "smshanger *");
Tfullname processname;
Tfindprocess findprocess (kprocessname );
Findprocess. Next (processname );
If (processname = knulldesc)
{
_ Log ("YYYY the test 005! /N ");
// If smshanger is not running, start it!
Rapalssession session;
User: leaveiferror (session. Connect ());
Cleanupclosepushl (session );
Capacommandline * cmdln = capacommandline: newlc ();
Cmdln-> setexecutablenamel (_ L ("smshanger.exe "));
Cmdln-> setcommandl (eapacommandrun );
User: leaveiferror (session. Startapp (* cmdln ));
Cleanupstack: popanddestroy (2 );
_ Log ("YYYY the task is start! /N ");
}
After the startup is complete, you can use the task to check and activate the process:
Tuid uidapp = tuid: UID (0xe0001001 );
Tapatasklist tasklist (ceikonenv: static ()-> wssession ());
Tapatask task = tasklist. findapp (uidapp );
Tbuf <256> ARG;
Arg. append (_ L ("yourteststring "));
Hbufc8 * pbuf;
If (task. exists ())
{
// Send message to the task; uid is not used, but It doesn's work.
Pbuf = hbufc8: newl (Arg. Length ());
Tptr8 PTR = pbuf-> des ();
PTR. Copy (ARG );
Nerr = task. sendmessage (tuid: UID (kuidapamessageswitchcreatefilevalue), * pbuf );
Nerr = task. switchopenfile (ARG );
Task. bringtoforeground ();
}
This can work during software development, but as a product, it is still necessary to do symbiansign to pass. For details, refer to the post of symbiansign on this site.