Creating a Control Panel Application

Introduction

A control panel application is used to modify system settings. To create a control panel application a registration resource file is required which contains information about the application UID and the name of the application’s executable.

Note: You need to create the registration resource file and specify its source and destination path in the mmp file.

Procedure

The following procedure describes how to prepare the registration resource file and create a control panel application:

  1. Define the attributes of the control panel application in the registration resource file.

    The attributes of the APP_REGISTRATION_INFO resource must have the KAppIsControlPanelItem attribute as shown in the code snippet:

    #include <appinfo.rh>
    UID2 KUidAppRegistrationResourceFile
    UID3 0x23256ADE
    RESOURCE APP_REGISTRATION_INFO
        {    
        app_file = app_CTRL2;
        attributes=KAppIsControlPanelItem;
        }
  2. In the source code of the application, create an instance of the CApaSystemControlList class using the CApaSystemControlList::NewL() function to create and initialize a control panel application list as shown in the code snippet. The CApaSystemControlList class provides a list of all the available control panel applications present on the device.

    
    // Create a file server session by creating an RFs object.
    
    RFs fs;
    fs.Connect();
    CApaSystemControlList* cControlList;
    
    TRAP(ret,cControlList=CApaSystemControlList::NewL(fs));
    if( ret==KErrNone )
        {
         //success scenario , implementation...
        }
  3. Also in the application's source code, create a control panel application in either of the following ways:

    // Using UID
    const TInt KsimpleAppUidValue = 0x23256ADE;
    
    // Create the control panel application in the list using the specified UID
    
    CApaSystemControl* Control = cControlList->Control(TUid(KsimpleAppUidValue));
    

    //Using Index
    // Create a control panel application using the index ID
    TInt indexID = 2;
    
    CApaSystemControl* control=cControlList->Control(indexID);