×
Namespaces

Variants
Actions

Getting Eikon environment pointer

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N95
Compatibility
Platform(s): S60 3rd Edition, MR
Article
Keywords: CEikonEnv, iEikonEnv
Created: tepaa (10 Jun 2008)
Last edited: hamishwillee (13 Jun 2012)

Contents

Overview

The following code snippet shows how to get an Eikon environment handle in a UI application.

Every GUI application is provided with an instance of CEikonEnv by the framework, which can be accessed through either CEikonEnv::Static() or the iEikonEnv macro of CEikApplication that uses iCoeEnv.

MMP file

The following capabilities and libraries are required:

CAPABILITY NONE
LIBRARY eikcore.lib

Getting pointer with iEikonEnv macro of CEikApplication

This can be used, for example, in CAknAppUi, CAknView, and CCoeControl. These classes have iCoeEnv as the member variable that is needed when using the iEikonEnv macro. The iEikonEnv macro is defined in the eikdef.h header.

// Getting Eikon environment pointer
iEikonEnv;
// Calling some method from Eikon pointer
CEikAppUi* ui = iEikonEnv->EikAppUi();

Using CEikonEnv::Static()

CEikonEnv::Static() should be used in, for example, the application engine class because iCoeEnv is not a member variable. CEikonEnv is defined in the eikenv.h header.

// Needed includes
#include <eikdef.h>
#include <eikenv.h>
 
// Getting Eikon environment pointer
CEikonEnv::Static();
// Calling some method from Eikon pointer
CEikAppUi* ui = CEikonEnv::Static()->EikAppUi();
This page was last modified on 13 June 2012, at 09:16.
59 page views in the last 30 days.