Launching the correct viewer app on Symbian
Article Metadata
Compatibility
S60 2nd Edition, FP1
S60 2nd Edition, FP2
S60 2nd Edition, FP3
S60 3rd Editon
Article
Overview
Launching the correct viewer application
Description
If a file (content) type is supported in the device, the correct viewer for it can be launched as an embedded application with the CDocumentHandler class as follows:
#include <DocumentHandler.h> // link against commonui.lib
#include <apmstd.h> // link against apmime.lib
void TTestEmbedApp::EmbedLaunchFileL( const TDesC& aFile )
{
// iDocHandler is a pointer to CDocumentHandler
if( !iDocHandler )
{
// On S60 3rd Edition, CDocumentHandler constructor no longer requires
// a CEikProcess pointer as a parameter
#ifdef __SERIES60_3X__
iDocHandler = CDocumentHandler::NewL();
#else
iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
#endif
}
TDataType empty;
iDocHandler->OpenFileEmbeddedL( aFile, empty );
}
This will launch the correct application to display the specified file. Because an empty data (MIME) type is used, document handler tries to resolve the data type automatically by passing the file to system recognizers. For example, if the file (aFile) is a .txt file, the Notes application will be launched. If the file is a .jpg file, Gallery/Image Viewer will be launched.


Md. Kayesh - How to retain the control of the CBA button ?
hi,
I could run system image viewer in this way, but at the same time I want to change the cba button as my need even during the system image viewer is running. Is it possible ? Or is it possible to make another layer of cba button over the cba of system app at that time ? So that when user pres those cba, my main app will be notified.Md. Kayesh 14:57, 29 April 2012 (EEST)