How to Invoke the browser from your app
06月 14th, 2008
Got the following code snippet from forum nokia wiki , one thing to take care of is that you need the SwEvent capability when there is a browser already running!
void CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl)
{
const TInt KBrowserUid = 0×10008D39;
TUid id( TUid::Uid( KBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param = HBufC8::NewLC( aUrl.Length() + 2);
param->Des().Append(_L(“4 “));
param->Des().Append(aUrl);
//Need the WsEvent Capability
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
CleanupStack::PopAndDestroy(param);
}
else
{
HBufC16* param = HBufC16::NewLC( aUrl.Length() + 2);
param->Des().Append(_L(“4 “));
param->Des().Append(aUrl);
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid), id );
appArcSession.Close();
CleanupStack::PopAndDestroy(param);
}
}
Popularity: 22% [?]
Entry Filed under: Symbian开发技巧
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed