symbian下面浏览器的调用方法
TBool CMcAppUi::invokWapUrl(TDesC & url) {
const TInt KBrowserUid = 0x10008D39; // the inner browser's id
TUid id( TUid::Uid( KBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() ) ;
TApaTask task = taskList.FindApp( id ) ;
RApaLsSession appArcSession;
TThreadId thread_id = 0;
HBufC * param ;
HBufC8 * param8 ;
param = HBufC::NewLC( 50 );
param->Des().Copy( _L( "4 " ) );
param->Des().Append(url) ;
if ( task.Exists() ) {
param8 = HBufC8::NewLC( param->Length() );
param8->Des().Append( *param );
task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
CleanupStack::PopAndDestroy();
} else {
User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), thread_id );
appArcSession.Close();
}
CleanupStack::PopAndDestroy();
return ETrue ;
}
应该很一目了然了,不需要过多解释了.
下面的这段代码是把浏览器嵌入到当前程序的视图中,
嗬嗬,看上去inner浏览器就好像是你的程序自己带的一样。
#include "QWebExternalInterface.h"
...
void CYourAppUi::OpenUrl()
{
TVwsViewId id(KUidQWebApp, KUidQWebPageView);
TQWebDNLUrlEntry dnlURL;
TBuf<KWebMaxUrlLen> theURL;
iEikonEnv->ReadResource(theURL,R_RESOURCE_URL);
dnlURL.iUrl = theURL;
TQWebDNLUrlEntryBuf dnlBuf(dnlURL);
ActivateViewL(id, KQWebCustomMsgId, dnlBuf);
}
const TInt KBrowserUid = 0x10008D39; // the inner browser's id
TUid id( TUid::Uid( KBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() ) ;
TApaTask task = taskList.FindApp( id ) ;
RApaLsSession appArcSession;
TThreadId thread_id = 0;
HBufC * param ;
HBufC8 * param8 ;
param = HBufC::NewLC( 50 );
param->Des().Copy( _L( "4 " ) );
param->Des().Append(url) ;
if ( task.Exists() ) {
param8 = HBufC8::NewLC( param->Length() );
param8->Des().Append( *param );
task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
CleanupStack::PopAndDestroy();
} else {
User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid ), thread_id );
appArcSession.Close();
}
CleanupStack::PopAndDestroy();
return ETrue ;
}
应该很一目了然了,不需要过多解释了.
下面的这段代码是把浏览器嵌入到当前程序的视图中,
嗬嗬,看上去inner浏览器就好像是你的程序自己带的一样。
#include "QWebExternalInterface.h"
...
void CYourAppUi::OpenUrl()
{
TVwsViewId id(KUidQWebApp, KUidQWebPageView);
TQWebDNLUrlEntry dnlURL;
TBuf<KWebMaxUrlLen> theURL;
iEikonEnv->ReadResource(theURL,R_RESOURCE_URL);
dnlURL.iUrl = theURL;
TQWebDNLUrlEntryBuf dnlBuf(dnlURL);
ActivateViewL(id, KQWebCustomMsgId, dnlBuf);
}