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