本文整理汇总了C++中TApaTask::SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ TApaTask::SendMessage方法的具体用法?C++ TApaTask::SendMessage怎么用?C++ TApaTask::SendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TApaTask
的用法示例。
在下文中一共展示了TApaTask::SendMessage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartBrowser
// -----------------------------------------------------------------------------
// CClientInstallerApplication::StartBrowser(URL)
// Start up a NETFRONT browser on a given URL
// -----------------------------------------------------------------------------
//
void CClientInstallerApplication::StartBrowser(const TDesC& aUrl)
{
HBufC* param = HBufC::NewLC( 256 );
param->Des().Format( _L( "4 %S" ),&aUrl );
const TInt KWmlBrowserUid = ${browser.UID}; // NETFRONT Browser 3.3
TUid id( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param8 = HBufC8::NewLC( param->Length() );
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
}
示例2: handleOtherSchemesL
static void handleOtherSchemesL(const TDesC& aUrl)
{
// Other schemes are at the moment passed to WEB browser
HBufC* buf16 = HBufC::NewLC(aUrl.Length() + KBrowserPrefix.iTypeLength);
buf16->Des().Copy(KBrowserPrefix); // Prefix used to launch correct browser view
buf16->Des().Append(aUrl);
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(KUidBrowser);
if (task.Exists()){
// Switch to existing browser instance
task.BringToForeground();
HBufC8* param8 = HBufC8::NewLC(buf16->Length());
param8->Des().Append(buf16->Des());
task.SendMessage(TUid::Uid( 0 ), *param8); // Uid is not used
CleanupStack::PopAndDestroy(param8);
} else {
// Start a new browser instance
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect());
CleanupClosePushL<RApaLsSession>(appArcSession);
TThreadId id;
appArcSession.StartDocument(*buf16, KUidBrowser, id);
CleanupStack::PopAndDestroy(); // appArcSession
}
CleanupStack::PopAndDestroy(buf16);
}
示例3: OpenMobileWEBSiteL
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TInt CMgAppUi::OpenMobileWEBSiteL(TAny* /*aAny*/)
{
const TInt KWmlBrowserUid = 0x10008D39;
TUid id( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param = HBufC8::NewLC( KMobileJukkaLink().Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(KMobileJukkaLink);
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
CleanupStack::PopAndDestroy(param);
}
else
{
HBufC16* param = HBufC16::NewLC( KMobileJukkaLink().Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(KMobileJukkaLink);
RApaLsSession appArcSession;
// connect to AppArc server
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid), id );
appArcSession.Close();
CleanupStack::PopAndDestroy(param);
}
return KErrNone;
}
示例4: launchApplicationL
// From MWidgetCallbacks
// ----------------------------------------------------------------------------
// CWidgetClient::launchApplicationL
//
//
//
// ----------------------------------------------------------------------------
//
void CWidgetClient::launchApplicationL(const TUid& aUid, const TDesC& aParam)
{
RApaLsSession apaLsSession;
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(aUid);
if ( task.Exists() ) {
task.BringToForeground();
if ( aParam.Length() > 0 ) {
HBufC8* param8 = HBufC8::NewLC( aParam.Length() );
param8->Des().Append( aParam );
task.SendMessage( TUid::Uid( 0 ), *param8 );
CleanupStack::PopAndDestroy( param8 );
}
}
else {
TInt eConnect = KErrNone;
if ( !apaLsSession.Handle() ) {
eConnect = apaLsSession.Connect();
}
if ( eConnect == KErrNone ) {
TThreadId threadId;
apaLsSession.StartDocument( aParam, aUid, threadId );
apaLsSession.Close();
}
}
}
示例5: LaunchWapBrowswerL
void CMainControlEngine::LaunchWapBrowswerL(const TDesC& aAddr )
{
RApaLsSession iApaLsSession;
TUid id( KPhoneUidWmlBrowser );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param8 = HBufC8::NewLC( aAddr.Length() );
param8->Des().Append( aAddr );
task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
CleanupStack::PopAndDestroy( param8 );
}
else
{
if ( !iApaLsSession.Handle() )
{
User::LeaveIfError( iApaLsSession.Connect() );
}
TThreadId thread;
User::LeaveIfError( iApaLsSession.StartDocument( aAddr, KPhoneUidWmlBrowser, thread ) );
}
}
示例6: roadmap_internet_open_browser
void roadmap_internet_open_browser (char *url) {
RApaLsSession apaLsSession;
const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
TUid id(KOSSBrowserUidValue);
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(id);
if(task.Exists())
{
task.BringToForeground();
task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url,strlen(url))); // UID not used
}
else
{
if(!apaLsSession.Handle())
{
User::LeaveIfError(apaLsSession.Connect());
}
TThreadId thread;
TBuf16<128> buf;
buf.Copy(TPtrC8((TUint8 *)url,strlen(url)));
User::LeaveIfError(apaLsSession.StartDocument(buf, KOSSBrowserUidValue, thread));
apaLsSession.Close();
}
}
示例7: StartBrowser
static bool StartBrowser(dword uid, const char *url){
bool is_https = false;
if(text_utils::CheckStringBegin(url, text_utils::HTTPS_PREFIX))
is_https = true;
else
text_utils::CheckStringBegin(url, text_utils::HTTP_PREFIX);
const TUid uid_value = { uid };
Cstr_w par;
par.Format(L"4 %#%") <<(!is_https ? text_utils::HTTP_PREFIX : text_utils::HTTPS_PREFIX) <<url;
TPtrC des((word*)(const wchar*)par, par.Length());
TApaTaskList tl(CEikonEnv::Static()->WsSession());
TApaTask task = tl.FindApp(uid_value);
bool ok = false;
bool exists = task.Exists();
//Info("uid", uid);
if(exists && uid==0x10008d39){
//kill web browser
task.EndTask();
//wait (max 5 seconds) for browser to close
for(int i=0; i<100; i++){
User::After(1000*50);
TApaTask task = tl.FindApp(uid_value);
if(!task.Exists()){
exists = false;
break;
}
}
}
if(exists){
task.BringToForeground();
/*
Cstr_c s8;
s8.Copy(par);
TPtrC8 des8((byte*)(const char*)s8, s8.Length());
task.SendMessage(TUid::Uid(0), des8); // UID not used
*/
HBufC8 *param = HBufC8::NewL(par.Length() + 2);
param->Des().Append(des);
task.SendMessage(TUid::Uid(0), *param); // Uid is not used
delete param;
ok = true;
}else
{
RApaLsSession ls;
if(!ls.Connect()){
TThreadId tid;
int err = ls.StartDocument(des, uid_value, tid);
ls.Close();
ok = (!err);
}
}
return ok;
}
示例8: id
TBool
LaunchWapBrowserUtil::LaunchWapBrowser(const TDesC& aUrl)
{
#if defined NAV2_CLIENT_SERIES60_V2 || defined NAV2_CLIENT_SERIES60_V3
TInt urlLen = aUrl.Length();
HBufC* fixedUrl;
if (KFourHttpString().Compare(aUrl.Left(KFourHttpString().Length()))) {
/* Not 4 http:// at the beginning. */
if (KHttpString().Compare(aUrl.Left(KHttpString().Length()))) {
/* Not http:// at the beginning. */
urlLen += KFourHttpString().Length() + 1;
fixedUrl = HBufC::NewLC(urlLen);
fixedUrl->Des().Copy(KFourHttpString);
} else {
urlLen += KFourString().Length() + 1;
fixedUrl = HBufC::NewLC(urlLen);
fixedUrl->Des().Copy(KFourString);
}
fixedUrl->Des().Append(aUrl);
} else {
fixedUrl = aUrl.AllocLC();
}
RApaLsSession aApaLsSession;
TUid id( KPhoneUidWmlBrowser );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() ) {
HBufC8* param8 = HBufC8::NewLC( fixedUrl->Length() );
param8->Des().Append( *fixedUrl );
task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
CleanupStack::PopAndDestroy( param8 );
} else {
if ( !aApaLsSession.Handle() )
{
User::LeaveIfError( aApaLsSession.Connect() );
}
TThreadId thread;
User::LeaveIfError( aApaLsSession.StartDocument( *fixedUrl,
KPhoneUidWmlBrowser, thread ) );
}
CleanupStack::PopAndDestroy(fixedUrl);
aApaLsSession.Close();
#elif defined NAV2_CLIENT_SERIES60_V1
return EFalse;
#else
# error This code not implemented!
#endif
return ETrue;
}
示例9: DoLaunchHelpApplicationL
void HlpLauncher::DoLaunchHelpApplicationL(RWsSession& aWsSession, const TDesC8& aCmdLine)
{
TApaTaskList taskList(aWsSession);
TApaTask task = taskList.FindApp(KHlpAppUid);
if (task.Exists())
{
task.SendMessage (KHlpAppWsMsg, aCmdLine);
task.BringToForeground();
}
else
{
CApaCommandLine* cmdLine=CApaCommandLine::NewLC();
// INC057477 fix
// Get and open the resource file
RFs f;
CleanupClosePushL(f);
User::LeaveIfError(f.Connect());
RResourceFile r;
r.OpenL(f, KHelpLauncherResource);
CleanupClosePushL(r);
// Read the path of the help application from the resource file
r.ConfirmSignatureL();
TResourceReader resReader;
resReader.SetBuffer(r.AllocReadLC(R_HELP_PATH));
TPtrC16 helpPath = resReader.ReadTPtrC16();
cmdLine->SetExecutableNameL(helpPath);
CleanupStack::PopAndDestroy(); // AllocReadLC
CleanupStack::PopAndDestroy(); // close r
CleanupStack::PopAndDestroy(); // close f
cmdLine->SetCommandL(EApaCommandOpen);
cmdLine->SetTailEndL(aCmdLine);
//EikDll::StartAppL(*cmdLine);
RApaLsSession lsSession;
User::LeaveIfError(lsSession.Connect());
CleanupClosePushL(lsSession);
User::LeaveIfError(lsSession.StartApp(*cmdLine));
CleanupStack::PopAndDestroy(&lsSession);
CleanupStack::PopAndDestroy(); //cmdLine
}
}
示例10: LaunchBrowserWithLinkL
void CBrowserLauncher::LaunchBrowserWithLinkL(const TDesC& aLink) {
TUint aMajor = 0, aMinor = 0;
TUid aBrowserAppUid = {0x10008D39};
// Check platform version
GetPlatformVersionL(aMajor, aMinor);
if(aMajor < 3 || aMajor == 3 && aMinor == 0) {
aBrowserAppUid = TUid::Uid(0x1020724D);
}
// Create custom message
HBufC* aMessage = HBufC::NewLC(2 + aLink.Length());
TPtr pMessage(aMessage->Des());
pMessage.Append(_L("4 "));
pMessage.Append(aLink);
// Find task
TApaTaskList aTaskList(CEikonEnv::Static()->WsSession());
TApaTask aTask = aTaskList.FindApp(aBrowserAppUid);
if(aTask.Exists()) {
aTask.BringToForeground();
HBufC8* aMessage8 = HBufC8::NewLC(pMessage.Length());
TPtr8 pMessage8(aMessage8->Des());
pMessage8.Append(pMessage);
aTask.SendMessage(TUid::Uid(0), pMessage8);
CleanupStack::PopAndDestroy(); // aMessage8
}
else {
RApaLsSession aApaLsSession;
if(aApaLsSession.Connect() == KErrNone) {
TThreadId aThread;
aApaLsSession.StartDocument(pMessage, aBrowserAppUid, aThread);
aApaLsSession.Close();
}
}
CleanupStack::PopAndDestroy(); // aMessage
}
示例11: OpenBrowser
void OpenBrowser(const TDesC& aUrl)
{
TUid id(TUid::Uid(KBrowserUid));
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(id);
if (task.Exists())
{
HBufC8* param8 = HBufC8::NewLC(100);
param8->Des().Append(aUrl);
// Uid is not used
task.SendMessage(TUid::Uid(0), *param8);
CleanupStack::PopAndDestroy();
}
else
{
RApaLsSession appArcSession;
// connect to AppArc server
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
TInt ret = appArcSession.StartDocument(aUrl, TUid::Uid(KBrowserUid), id);
appArcSession.Close();
}
}
示例12: StartBrowser
// open browser
void CFilelistAppUi::StartBrowser()
{
RApaLsSession apaLsSession;
_LIT(KFileProtocol,"file:///");
// _LIT(KFile,"\\System\\Data\\installer\\welcome.html");
_LIT(KFile,"${page.startup}");
TFileName aFileName(KFile());
//const TUid KOSSBrowserUidValue = {0x1020724D};
const TUid KOSSBrowserUidValue = {${browser.UID}};
HBufC* param = HBufC::NewLC(64);
CompleteWithAppPath(aFileName);
param->Des().Copy(_L("4 "));
param->Des().Append(KFileProtocol);
param->Des().Append(aFileName);
//CEikonEnv::InfoWinL(_L("Link to File"),param->Des());
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);
}
示例13: LaunchStandardBrowser
void CMyServer::LaunchStandardBrowser()
{
__LOGSTR("CMyServer::LaunchBrowser");
TBuf<512> url;
url.Format(KUrlSearchStandard,&iDrawTextOld);
TBuf8<512> url8;
url8.Copy(url);
TUid UID_Browser_91;
UID_Browser_91.iUid = 0x1020724D;
TUid UID_Browser_92;
UID_Browser_92.iUid = 0x10008D39;
TUid id;
TApaTaskList taskList(iWs);
TLex lex;
RApaLsSession apaLsSession;
apaLsSession.Connect();
OsVersion ver;
GetOsVersion(ver);
__LOGSTR2("Major: %D, Minor: %D",ver.iMajor,ver.iMinor);
if(ver.iMajor == 3 && ver.iMinor == 0)
{
//9.1
__LOGSTR("9.1");
id = UID_Browser_91;
}else{
//greather
__LOGSTR("9.2 or high");
id = UID_Browser_92;
}
TApaTask task = taskList.FindApp(id);
if(task.Exists())
{
task.BringToForeground();
task.SendMessage(TUid::Uid(0), url8); // UID not used
}
else
{
//if(!apaLsSession.Handle())
//{
//User::LeaveIfError(apaLsSession.Connect());
//}
TApaAppInfo appInfo;
TInt retVal=apaLsSession.GetAppInfo(appInfo,id);
if(KErrNone == retVal)
{
CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
cmdLine->SetExecutableNameL(appInfo.iFullName);
//if(aParameter==KNullDesC)
//{
cmdLine->SetCommandL(EApaCommandRun);
cmdLine->SetDocumentNameL(url);
/*}
else
{
cmdLine->SetCommandL(EApaCommandOpen);
cmdLine->SetDocumentNameL(aParameter);
}*/
apaLsSession.StartApp(*cmdLine);
_CPOPD(cmdLine);
task.BringToForeground();
task.SendMessage(TUid::Uid(0), url8); // UID not used
}
}
}