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.
How to get the current screen orientation using Symbian C++
S60 5th Edition
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
This article shows how to get the current screen orientation using Symbian C++
Using screen dimensions
Below is a reliable way to query the screen dimensions, and hence determine orientation, using Symbian C++.
CWsScreenDevice* screenDevice = CEikonEnv::Static()->ScreenDevice();
const TSize& screenSize = screenDevice->SizeInPixels();
if (screenSize.iWidth > screenSize.iHeight)
This snippet below shows how to get current orientation by using CAknAppUiBase::Orientation().
You cannot call CAknAppUiBase::Orientation() directly in a class which is not derived directly or indirectly from CAknAppUiBase or if you do not have access to AppUi instance, then you can also fetch the information using CCoeEnv.
This snippet can be self-signed and we assume that we already have a working GUI based application.
The following capabilities and libraries are required:
CCoeEnv* env = CCoeEnv::Static();
if( env )
CAknAppUiBase* appUiBase = REINTERPRET_CAST( CAknAppUiBase*, env->AppUi() );
if( appUiBase )
* Possible values for TAppUiOrientation are :
CAknAppUiBase::TAppUiOrientation orientation = appUiBase->Orientation();