Start the process with parameters in Symbian 3rd

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.