Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Launching the correct viewer app on Symbian

From Wiki
Jump to: navigation, search

Article Metadata
Platform(s): S60 2nd Edition
S60 2nd Edition, FP1
S60 2nd Edition, FP2
S60 2nd Edition, FP3
S60 3rd Editon
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Created: User:Technical writer 2 (17 Mar 2005)
Last edited: hamishwillee (14 Jun 2012)


Launching the correct viewer application


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();
       iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
  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.

This page was last modified on 14 June 2012, at 04:54.
50 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.