Answer

专注于Mobile,WinCE
  首页  :: 新随笔  :: 联系 :: 管理

[转]Using Control Panel

Posted on 2008-11-20 15:40  answer  阅读(540)  评论(0编辑  收藏  举报

Using Control Panel

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.

Contrast

Contrast

Applet Id: 0
Applet Id: ST_CPAPPLET_CONTRAST

Password

Password

Applet Id: 1
Applet Id: ST_CPAPPLET_PASSWORD

Owner Information. Identification

Owner Information. Identification

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

Owner Information. Notes

Owner Information. Notes

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

Power

Power

Applet Id: 3
Applet Id: ST_CPAPPLET_POWER

Memory. Main

Memory. Main

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

Memory. Running Programs

Memory. Running Programs

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

About. Version

About. Version

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

About. Device ID

About. Device ID

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

About. Copyrights

About. Copyrights

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

Backlight. Battery Power

Backlight. Battery Power

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

Backlight. External Power

Backlight. External Power

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

Input. Input Method

Input. Input Method

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

Input. Word Completion

Input. Word Completion

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

Input. Options

Input. Options

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

Sounds & Reminders. Valume

Sounds & Reminders. Valume

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

Sounds & Reminders. Sounds

Sounds & Reminders. Sounds

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

Sounds & Reminders. Reminders

Sounds & Reminders. Reminders

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

Remove Programs

Remove Programs

Applet Id: 10
Applet Id: ST_CPAPPLET_REMOVEPROGS

Menus. Start Menu

Menus. Start Menu

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

Menus. New Menu

Menus. New Menu

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

Buttons. Program Buttons

Buttons. Program Buttons

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

Buttons. Up/Down Control

Buttons. Up/Down Control

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

Today

Today

Applet Id: 13
Applet Id: ST_CPAPPLET_TODAY

Clock. Time

Clock. Time

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

Clock. Alarms

Clock. Alarms

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

Regional Settings. Region

Regional Settings. Region

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

Regional Settings. Number

Regional Settings. Number

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

Regional Settings. Currency

Regional Settings. Currency

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

Regional Settings. Time

Regional Settings. Time

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

Regional Settings. Date

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