By Vassili Philippov, October 29, 2001.
Print version

Introduction

Sometimes we need to show a control panel applet (control panel page) from our program. That is necessary when users of your program often change some system settings and you want to provide an easy interface for that. This article shows how to open certain control panel applet from your program.

You should be careful because some Pocket PC devices don't support some control panel applets. You can find information about applets support in Creating Shortcuts to Feature Settings article by Steven Perry.

To open a Control Panel Page

You have to run ctlpnl.exe program with "cplmain.cpl,X,Y" argument where X is Id of the control panel applet and Y is an index of a tab page (most applets have several tabs). Here is a sample code that openes a control page with information about alarms.

CString strParam; strParam.Format(_T("cplmain.cpl,%d,%d"), 16, 1); PROCESS_INFORMATION pi; if (!::CreateProcess(_T("\\Windows\\ctlpnl.exe"), strParam, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)) { //Cannot start Control Panel process }

 

STControlPanel

You can also use STControlPanel library that encapsulates working with the control panel. You should create a CSTControlPanel object using control panel applet id and tab page index (the second parameter is optional).

Here is a sample code that openes a control page with information about alarms.

CSTControlPanel cp(ST_CPAPPLET_CLOCK, ST_CPAPPLET_CLOCK_ALARMS); cp.Open();

 

Control Panel Applets

This section enumerates only some control panel applets. Some devices contain more applets then the others, and not all enumerated applets are supported by all devices.

[转]Using Control Panel

Contrast

Applet Id: 0
Applet Id: ST_CPAPPLET_CONTRAST

[转]Using Control Panel

Password

Applet Id: 1
Applet Id: ST_CPAPPLET_PASSWORD

[转]Using Control Panel

Owner Information. Identification

Applet Id: 2
Tab Index: 0
Applet Id: ST_CPAPPLET_OWNERINFO
Tab Index: ST_CPAPPLET_OWNERINFO_IDENTIFICATION

[转]Using Control Panel

Owner Information. Notes

Applet Id: 2
Tab Index: 1
Applet Id: ST_CPAPPLET_OWNERINFO
Tab Index: ST_CPAPPLET_OWNERINFO_NOTES

[转]Using Control Panel

Power

Applet Id: 3
Applet Id: ST_CPAPPLET_POWER

[转]Using Control Panel

Memory. Main

Applet Id: 4
Tab Index: 0
Applet Id: ST_CPAPPLET_MEMORY
Tab Index: ST_CPAPPLET_MEMORY_MAIN

[转]Using Control Panel

Memory. Running Programs

Applet Id: 4
Tab Index: 1
Applet Id: ST_CPAPPLET_MEMORY
Tab Index: ST_CPAPPLET_MEMORY_RUNNINGPROGRAMS

[转]Using Control Panel

About. Version

Applet Id: 5
Tab Index: 0
Applet Id: ST_CPAPPLET_ABOUT
Tab Index: ST_CPAPPLET_ABOUT_VERSION

[转]Using Control Panel

About. Device ID

Applet Id: 5
Tab Index: 1
Applet Id: ST_CPAPPLET_ABOUT
Tab Index: ST_CPAPPLET_ABOUT_DEVICEID

[转]Using Control Panel

About. Copyrights

Applet Id: 5
Tab Index: 2
Applet Id: ST_CPAPPLET_ABOUT
Tab Index: ST_CPAPPLET_ABOUT_COPYRIGHTS

[转]Using Control Panel

Backlight. Battery Power

Applet Id: 6
Tab Index: 0
Applet Id: ST_CPAPPLET_BACKLIGHT
Tab Index: ST_CPAPPLET_BACKLIGHT_BATTERY

[转]Using Control Panel

Backlight. External Power

Applet Id: 6
Tab Index: 1
Applet Id: ST_CPAPPLET_BACKLIGHT
Tab Index: ST_CPAPPLET_BACKLIGHT_EXTERNAL

[转]Using Control Panel

Input. Input Method

Applet Id: 8
Tab Index: 0
Applet Id: ST_CPAPPLET_INPUT
Tab Index: ST_CPAPPLET_INPUT_INPUTMEHTOD

[转]Using Control Panel

Input. Word Completion

Applet Id: 8
Tab Index: 1
Applet Id: ST_CPAPPLET_INPUT
Tab Index: ST_CPAPPLET_INPUT_WORDCOMPLETION

[转]Using Control Panel

Input. Options

Applet Id: 8
Tab Index: 2
Applet Id: ST_CPAPPLET_INPUT
Tab Index: ST_CPAPPLET_INPUT_OPTIONS

[转]Using Control Panel

Sounds & Reminders. Valume

Applet Id: 9
Tab Index: 0
Applet Id: ST_CPAPPLET_SNDANDREMINDERS
Tab Index: ST_CPAPPLET_SNDANDREMINDERS_VOLUME

[转]Using Control Panel

Sounds & Reminders. Sounds

Applet Id: 9
Tab Index: 1
Applet Id: ST_CPAPPLET_SNDANDREMINDERS
Tab Index: ST_CPAPPLET_SNDANDREMINDERS_SOUNDS

[转]Using Control Panel

Sounds & Reminders. Reminders

Applet Id: 9
Tab Index: 2
Applet Id: ST_CPAPPLET_SNDANDREMINDERS
Tab Index: ST_CPAPPLET_SNDANDREMINDERS_REMINDERS

[转]Using Control Panel

Remove Programs

Applet Id: 10
Applet Id: ST_CPAPPLET_REMOVEPROGS

[转]Using Control Panel

Menus. Start Menu

Applet Id: 11
Tab Index: 0
Applet Id: ST_CPAPPLET_MENUS
Tab Index: ST_CPAPPLET_MENUS_STARTMENU

[转]Using Control Panel

Menus. New Menu

Applet Id: 11
Tab Index: 1
Applet Id: ST_CPAPPLET_MENUS
Tab Index: ST_CPAPPLET_MENUS_NEWMENU

[转]Using Control Panel

Buttons. Program Buttons

Applet Id: 12
Tab Index: 0
Applet Id: ST_CPAPPLET_BUTTONS
Tab Index: ST_CPAPPLET_BUTTONS_PROGRAMBUTTONS

[转]Using Control Panel

Buttons. Up/Down Control

Applet Id: 12
Tab Index: 1
Applet Id: ST_CPAPPLET_BUTTONS
Tab Index: ST_CPAPPLET_BUTTONS_UPDOWNCONTROL

[转]Using Control Panel

Today

Applet Id: 13
Applet Id: ST_CPAPPLET_TODAY

[转]Using Control Panel

Clock. Time

Applet Id: 16
Tab Index: 0
Applet Id: ST_CPAPPLET_CLOCK
Tab Index: ST_CPAPPLET_CLOCK_TIME

[转]Using Control Panel

Clock. Alarms

Applet Id: 16
Tab Index: 1
Applet Id: ST_CPAPPLET_CLOCK
Tab Index: ST_CPAPPLET_CLOCK_ALARMS

[转]Using Control Panel

Regional Settings. Region

Applet Id: 18
Tab Index: 0
Applet Id: ST_CPAPPLET_RS
Tab Index: ST_CPAPPLET_RS_REGION

[转]Using Control Panel

Regional Settings. Number

Applet Id: 18
Tab Index: 1
Applet Id: ST_CPAPPLET_RS
Tab Index: ST_CPAPPLET_RS_NUMBER

[转]Using Control Panel

Regional Settings. Currency

Applet Id: 18
Tab Index: 2
Applet Id: ST_CPAPPLET_RS
Tab Index: ST_CPAPPLET_RS_CURRENCY

[转]Using Control Panel

Regional Settings. Time

Applet Id: 18
Tab Index: 3
Applet Id: ST_CPAPPLET_RS
Tab Index: ST_CPAPPLET_RS_TIME

[转]Using Control Panel

Regional Settings. Date

Applet Id: 18
Tab Index: 4
Applet Id: ST_CPAPPLET_RS
Tab Index: ST_CPAPPLET_RS_DATE

Related resources:

 

DEMO:

  C#    EVC

 

转自:

http://www.pocketpcdn.com/articles/controlpanel.html

http://www.cnblogs.com/fox23/archive/2008/11/14/showing-Windows-mobile-control-panel-programmatically.html

 

相关文章: