×
Namespaces

Variants
Actions
Revision as of 18:43, 4 September 2009 by sangramp@cybage.com (Talk | contribs)

Archived:How to make Flash launcher with Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
{{{width}}}

To have an icon in normal menu you need to make a Symbian application and you need to define the normal application framework etc. These you can do with the application wizard. How to change the application icon is shown in How to define application icon. Then just add the codes to the application user interface class.

Contents

Symbian S60 3rd Edition devices

With S60 3rd Edition you can use RFile with Document handler as follows (shown also in Run_Flash.cpp file):

iHandler = CDocumentHandler::NewL( NULL );
iHandler->SetExitObserver(this);
 
TFindFile AufFolder(CCoeEnv::Static()->FsSession());
if(KErrNone == AufFolder.FindByDir(KTxtFlashFileName, KNullDesC))
{
RFile Runfile;
User::LeaveIfError(Runfile.Open(CCoeEnv::Static()->FsSession(), aFlashAppName, EFileShareReadersOnly));
CleanupClosePushL(Runfile);
 
TDataType Dummy;
 
User::LeaveIfError(iHandler->OpenFileEmbeddedL(Runfile, Dummy));
 
CleanupStack::PopAndDestroy(); // sharedfile
}

Note that you also need to implement the MAknServerAppExitObserver in your Application user interface class.

Symbian S60 3rd Edition FP1 devices

... dedicated API ...

Symbian S60 Pre-3rd Edition devices

With 2nd Edition you can utilize the RApaLsSession directly as follows (shown also in Run_Flash2.cpp file):

RApaLsSession session;
session.Connect();
CleanupClosePushL(session);
 
TFindFile AppFile(CCoeEnv::Static()->FsSession());
if(KErrNone == AppFile.FindByDir(KTxtFlashFileName, KNullDesC))
{
TThreadId id;
User::LeaveIfError(session.StartDocument(AppFile.File(), id));
}
 
CleanupStack::PopAndDestroy();//session.Close();


Run_Flash2.cpp

#include <apgcli.h>
 
_LIT(KTxtFlashFileName, ":\\others\\MyFlashFile.swf" );
//_LIT(KTxtFlashFileName, ":\\private\\<My-SID>\\MyFlashFile.swf" );
 
 
void CFlashStubAppUi::ConstructL()
{
BaseConstructL(CAknAppUi::EAknEnableSkin);
 
RApaLsSession session;
session.Connect();
CleanupClosePushL(session);
 
TFindFile AppFile(CCoeEnv::Static()->FsSession());
if(KErrNone == AppFile.FindByDir(KTxtFlashFileName, KNullDesC))
{
TThreadId id;
User::LeaveIfError(session.StartDocument(AppFile.File(), id));
}
 
CleanupStack::PopAndDestroy();//session.Close();
 
User::Exit(0);
}
 
CFlashStubAppUi::CFlashStubAppUi()
{
// No implementation required
}
 
CFlashStubAppUi::~CFlashStubAppUi()
{
 
}
 
void CFlashStubAppUi::HandleCommandL( TInt aCommand )
{
switch( aCommand )
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
default:
break;
}
}


Run_Flash.cpp

#include <documenthandler.h>
#include <apgcli.h>
 
_LIT(KTxtFlashFileName, ":\\others\\MyFlashFile.swf" );
//_LIT(KTxtFlashFileName, ":\\private\\<My-SID>\\MyFlashFile.swf" );
 
void CFlashStubAppUi::ConstructL()
{
BaseConstructL(CAknAppUi::EAknEnableSkin);
 
iHandler = CDocumentHandler::NewL( NULL );
iHandler->SetExitObserver(this);
 
TFindFile AufFolder(CCoeEnv::Static()->FsSession());
if(KErrNone == AufFolder.FindByDir(KTxtFlashFileName, KNullDesC))
{
RFile Runfile;
User::LeaveIfError(Runfile.Open(CCoeEnv::Static()->FsSession(), aFlashAppName, EFileShareReadersOnly));
CleanupClosePushL(Runfile);
 
TDataType Dummy;
 
User::LeaveIfError(iHandler->OpenFileEmbeddedL(Runfile, Dummy));
 
CleanupStack::PopAndDestroy(); // sharedfile
}
}
 
CFlashStubAppUi::CFlashStubAppUi()
{
// No implementation required
}
 
CFlashStubAppUi::~CFlashStubAppUi()
{
delete iHandler;
}
 
void CFlashStubAppUi::HandleCommandL( TInt aCommand )
{
switch( aCommand )
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
default:
break;
}
}
 
void CFlashStubAppUi::HandleServerAppExit (TInt /* aReason */)
{
Exit();
}
102 page views in the last 30 days.
×