Call the Symbian browser to open a specified webpage

Source: Internet
Author: User

 

By adding the following class to the function, you can call the browser and open the specified webpage:
Header file # include <apgcli. h>
Void openurll (const tdesc & aurl)
{
If (aurl. Length () <= 0)
Return;
 
Hbufc * Param = hbufc: newlc (aurl. Length () + 8 );
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 () * 4 );
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
Return;
}
Call method: openurll (_ L ("www.yuelongr.cn "));
However, there are two browsers "network" and "service" on the s60 3rd device. The "network" uid is 0x1020724d, and the "service" uid is 0x10008d39, the above code starts the "service", but the specified webpage cannot be opened,

If you change UID to "network" uid, it can be opened normally, but there is only one browser left on the s60 3rd FP1 device, uid is 0x10008d39, this causes code versatility. To avoid generating two editions

In this program, we can first find out whether the program corresponding to the UID 0x1020724d exists in the system. If it exists, it indicates that the mobile phone is based on s60 3rd, if it is not stored, it is based on s60 3rd FP1.

Use 0x10008d39:
Void openurll (const tdesc & aurl)
{
If (aurl. Length () <= 0)
Return;
 
Const tint kbrowseruid1 = 0x1020724d;
Const tint kbrowseruid2 = 0x10008d39;
 
Rapalssession apparcsession;
User: leaveiferror (apparcsession. Connect (); // connect to apparc Server
 
Hbufc * Param = hbufc: newlc (aurl. Length () + 8 );
Param-> des (). Format (_ L ("4% S"), & aurl );
 
// WAP browser's constants uid
Tuid browserid (tuid: UID (kbrowseruid1 ));
 
Tapaappinfo appinfo;
If (apparcsession. getappinfo (appinfo, browserid )! = Kerrnone)
{
Browserid = tuid: UID (kbrowseruid2 );
}
 
Tapatasklist tasklist (ceikonenv: static ()-> wssession ());
Tapatask task = tasklist. findapp (browserid );
If (task. exists ())
{
Hbufc8 * param8 = hbufc8: newlc (param-> length () * 4 );
Param8-> des (). append (* PARAM );
Task. sendmessage (tuid: UID (0), * param8); // uid is not used
Cleanupstack: popanddestroy (); // param8
}
Else
{
Tthreadid ID;
Apparcsession. startdocument (* Param, browserid, ID );
}
 
Apparcsession. Close ();
Cleanupstack: popanddestroy (); // Param
Return;
}
Call method: openurll (_ L ("www.yuelongr.cn "));
Statement:
This post is made up of the Internet. Thanks to the original author for sharing it.
This article from yuelongr http://www.yuelongr.cn/original address: http://www.yuelongr.cn/post/25.html

 

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.