Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

在S60第三版中启动web浏览器打开一个指定的URL

From Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台:
Symbian

文章
huwell 在 27 Jun 2007 创建
最后由 hamishwillee 在 08 May 2013 编辑
  • 设备, 软件 版本:

S60 3rd Edition


  • 详细描述:

为了启动在S60第三版上的web浏览器,自动打开一个指定的URL,该应用程序必须能处理SWEvent。 参考代码:

RApaLsSession apaLsSession;
 
const TUid KOSSBrowserUidValue = {0x1020724D};
 
HBufC* param = HBufC::NewLC(64);
 
param->Des().Copy(_L("4 http://www.yahoo.com/"));
 
TUid id(KOSSBrowserUidValue);
 
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
 
TApaTask task = taskList.FindApp(id);
 
if(task.Exists())
 
{
 
task.BringToForeground();
 
HBufC8* param8 = HBufC8::NewLC(param->Length());
 
param8->Des().Append(*param);
 
task.SendMessage(TUid::Uid(0), *param8); // UID not used
 
CleanupStack::PopAndDestroy(param8);
 
}
 
else
 
{
 
if(!apaLsSession.Handle())
 
{
 
User::LeaveIfError(apaLsSession.Connect());
 
}
 
TThreadId thread;
 
User::LeaveIfError(apaLsSession.StartDocument(*param, KOSSBrowserUidValue, thread));
 
apaLsSession.Close();
 
}
 
CleanupStack::PopAndDestroy(param);

注意:如果浏览器正在加载一个URL,而另一个程序试图去打开它。那就会在加载新的url时报“Unable to retrieve”错误。

This page was last modified on 8 May 2013, at 00:04.
51 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×