HowProgramTo call the control panel items that come with Windows Mobile System? We often see such problems in forums or contact groups. For example, we may need to add a "Remove program" function in our programs, or set an alarm, or you need to modify other system settings. In this case, you may need to directly call the control panel that comes with the system, which is much easier than modifying the registry and designing the message storage method and designing the UI.
The following class implements this function:
Class Controlapplet { Public static void Showapplet ( Applettype Applet) {processstartinfo startinfo = New Processstartinfo (); startinfo. filename = @ "\ Windows \ ctlpnl.exe" ; Startinfo. Arguments = String . Format ( "Cplmain. CPL, {0 }" ,( Byte ) Applet); process. Start (startinfo );} Public static void Showapplet ( Applettype Applet, Byte Tabindex) {processstartinfo startinfo = New Processstartinfo (); startinfo. filename = @ "\ Windows \ ctlpnl.exe" ; Startinfo. Arguments = String . Format ( "Cplmain. CPL, {0}, {1 }" ,( Byte ) Applet, tabindex); process. Start (startinfo );}Public Enum Applettype {Contrast, password, ownerinformation, power, memory, about, backlight, callback, inputmethod, callback, removeprograms, menus, buttons, todaysettings, pcconnections, modemconnections, clock, networkconnections, regionalsettings} # Region Constant Fields Public const byte Cpapplet_ownerinfo_identification = 0; Public const byte Cpapplet_ownerinfo_notes = 1; Public const byte Cpapplet_memory_main = 0;Public const byte Cpapplet_memory_runningprograms = 1; Public const byte Cpapplet_about_version = 0; Public const byte Cpapplet_about_deviceid = 1; Public const byte Cpapplet_about_copyrights = 2; Public const byte Cpapplet_backlight_battery = 0; Public const byte Cpapplet_backlight_external = 1; Public const byte Cpapplet_input_inputmehtodd = 0; Public const byte Cpapplet_input_wordcompletion = 1; Public const byte Cpapplet_input_options = 2; Public const byte Cpapplet_sndandreminders_volume = 0; Public const byte Cpapplet_sndandreminders_sounds = 1; Public const byte Cpapplet_sndandreminders_reminders = 2; Public const byte Cpapplet_menus_startmenu = 0; Public const byte Cpapplet_menus_newmenu = 1; Public const byte Cpapplet_buttons_programbuttons = 0; Public const byte Cpapplet_buttons_updowncontrol = 1; Public const byte Cpapplet_modem_connections = 0;Public const byte Cpapplet_modem_dialing = 1; Public const byte Cpapplet_clock_time = 0; Public const byte Cpapplet_clock_alarms = 1; Public const byte Cpapplet_rs_region = 0; Public const byte Cpapplet_rs_number = 1; Public const byte Cpapplet_rs_currency = 2; Public const byte Cpapplet_rs_time = 3; Public const byte Cpapplet_rs_date = 4; # Endregion }
To put it simple, just start ctlpnl.exe and input the corresponding parameters. Note that the first parameter indicates the console, and the second parameter (if any) indicates the specific tab of the console project, if it is null, it is the first tab by default. The usage is as follows:
Controlapplet. showapplet (controlapplet. applettype. Clock );
Effect:
Controlapplet. showapplet (controlapplet. applettype. Clock, controlapplet. cpapplet_clock_alarms );
Effect:
Download the complete example here:
Http://files.cnblogs.com/fox23/ControlPanelSample.rar
Enjoy!
Related information:
Show Control Panel programmatically
Http://www.pocketpcdn.com/articles/controlpanel.html