Developing for the Control Panel
Developing for the Control Panel-Windows Vista
Control Panel allows users to configure operating system features and perform related tasks such as hardware and software setup and configuration, security, system maintenance, and user account management. Many users do not perform Control Panel tasks frequently, so they may not remember how to begin, perform or complete these tasks. Control Panel has lots of control panel items, so some users have difficulty knowing which tasks to perform with which applets.
Microsoft Windows Vista® provides a visually enhanced and better-organized user interface that alleviates these problems and makes the Control Panel easier to use. Windows Vista also makes it easier for developers to add their own applets and tasks to the Control Panel.
Microsoft Windows Vista provides new features that make Control Panel more user-oriented. The new features in Windows Vista Control Panel include:
A fast search that allows users to quickly find applets and tasks from anywhere in Control Panel
A more enhanced Control Panel Home (similar to the category view in Windows XP) that makes browsing easier
Tasks Links that allow users to easily find tasks associated with each applet
An easy way for software developers to add and register their own applets and tasks to Control Panel
A new syntax for opening Control Panel applets programmatically
This article highlights the new features that may be of interest to software developers and only summarizes the new search and Task Link features. For detailed information on the search and Task Link features, see Control Panel User Interface.
Searching for Applets and Tasks Is Easy and Fast
The new search is a major feature in Windows Vista Control Panel.
The new search provides:
The ability to quickly find applets and tasks from anywhere in Control Panel. Tasks cannot be searched in Classic View.
The ability to quickly find applets from the start menu search box.
The ability to launch applets and tasks from search results.
Although Windows Vista provides almost twice as many applets as Windows XP, this new search feature makes navigating Control Panel very easy. For more information on the new search feature, see Control Panel User Interface.
Enhanced Control Panel View
Control Panel in Windows Vista has two views; Classic View and Control Panel Home. Classic View shows all the applets and their titles in a big alphabetical list, and Control Panel Home shows all the applets organized in categories. Control Panel Home also shows some of the most commonly used Task Links.
New in both Classic View and Control Panel Home, is the Search box (wordwheel) which allows you to search applets by name. Also new in Classic View is the category column. You can sort applets by category by clicking the category column in Classic View.
Microsoft’s investment in Control Panel enhancements are mostly in the Control Panel Home. This was done to improve user experience in the Control Panel and make it easier for users, software developers and administrators to complete their tasks quickly and efficiently.
Control Panel now has new hyperlinks that allow quick and easy navigation. In Control Panel Home, you can select a category to display the applets in that category. You can then click an applet to open the control panel item, or click a Task Link that appears under the applet to display a few of the tasks you can perform with that applet. For more information on the new search feature and enhanced views, see Control Panel User Interface.
Types of Control Panel Applets
There are three types of Control Panel applets:
Command objects—applets that run commands specified in the registry
Shell folders—applets open up in the Control Panel. Examples of shell folder applets are the Fonts Folder, Administrative Tools, Personalization, System, User Accounts, and Programs
CPLs—applets that implement the CplApplet function
Command objects are the easiest to implement.
Adding and Registering Your Own Applets and Tasks
Adding your own applet to Control Panel is easier in Windows Vista. Software developers can now easily add their own applets and tasks to Control Panel.
In previous versions of Windows, you add applets to the Control Panel by using the Windows Registry and the CplApplet function. The operating system uses the Registry to enumerate the modules containing the applets. Each module's CplApplet function is called to display the applet, its icon and description, and then invoke the applet. This process is more complicated than using command objects because the applet must implement the CplApplet Interface. Although this process is still supported in Windows Vista, using command objects is encouraged since it is easier to implement.
Now, in Windows Vista, you can just write an executable (.exe), register it as a command object and the applet appears in Control Panel. For example, you can write an executable, MySystemApplet.exe, for your applet and add the applet to Control Panel by simply registering MySystemApplet.exe as a shell command object instead of tediously modifying the binary with an implementation of the CplApplet interface.
The following code example registers MySystemApplet.exe applet as a command object and adds the applet to Control Panel.
To register MySystemApplet.exe applet as a command object and add the applet to Control Panel
Create a new GUID for your command object. This example uses {0052D9FC-6764-4D29-A66F-2F3BD9E2BB40} as a new GUID.
Set the value of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40} to MySystemApplet. Default Value = "MySystemApplet" and thenreplace the GUID with your GUID.
Note
For a 64 bit applet in a 64 bit version of Windows Vista, the registry entries must go to a 64 bit registry. For a 32 bit applet in a 64 bit version of Windows Vista, the registry entries must go to ControlPanelWOW64 rather than ControlPanel, as in the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanelWOW64\NameSpace\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}.
The ControlPanelWOW64 path does not exist in the default version and must be added.
SetHKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40} to the following values:
// Sets your applet’s display name. (Default value) as REG_SZ = "MySystemApplet" // Sets your applet's canonical name. System.ApplicationName as Reg_sz = "MyCompany.MySystemApplet" //Invoking control.exe /name MyCompany.MySystemApplet will launch the applet. // Adds the applet to Appearance and Personalization and the Programs categories. System.ControlPanel.Category as Reg_sz = "1,8" // Defines the module name and string table ID of the name of the applet. The format // starts with "@" followed by the .exe or .dll that contains the MUI string table, // followed by "-", followed by the ID in the string table. The format can also // contain just text if your applet does not have a string table. In this case, // the name will not be localized. LocalizedString as Reg_expand_sz = "@%SystemRoot%\MySystemApplet.exe,-9" // Same format as the LocalizedString. InfoTip as reg_expand_sz = "@%SystemRoot%\MySystemApplet.exe,-5"
Setthe default Icon ofHKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
//Sets the DefaultIcon to a default value. 2 represents the resource ID of the icon(default). reg_expand_sz = "%SystemRoot%\MySystemApplet.exe,-2"
Set the command for HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}\Shell\Open\Command.
// Specify the command to call when your icon gets invoked.(default) reg_expand_sz = "%ProgramFiles%\MyCompany\MySystemApplet.exe"
Under HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}, where this GUID is the GUID you used to register your applet, Set the value of System.Software.TasksFileUrl. "System.Software.TasksFileUrl" as reg_expand_sz = "C:\\test\\MySystemApplettasks.xml" so that "System.Software.TasksFileUrl" reg value points to the location of your installed tasks XML. See the sample code below for an example a task XML file.
The following table lists the values that represent each Control Panel category in Windows Vista.
Value |
Category Icon appears in |
---|---|
1 |
Appearance and Personalization |
2 |
Hardware and Sound |
3 |
Network and Internet |
4 |
Not used |
5 |
System and Maintenance |
6 |
Clock, Language and Region |
7 |
Ease of Access |
8 |
Programs |
9 |
User Accounts and Family Safety (called just "User Accounts" on business Release, and on Ultimate when joined to a domain) |
10 |
Security |
11 |
Mobile PC (this category only visible on laptop computers) |
The following code sample defines tasks in an XML file. You can point "System.Software.TasksFileUrl" reg to this XML file. |
---|
|
A New syntax for Opening Control Panel
Windows Vista provides a new syntax for opening Control Panel applets from code and the Start->Run menu by specifying simple, easy to understand canonical names for each applet. These new canonical names are the best way to access an applet because, if the implementation or the filename changes, the canonical name remains the same. For example, in previous versions of Windows, you launch Internet Properties (the Internet Explorer Control Panel applet) with the following syntax: Control.exe inetcpl.cpl. This syntax only works as long as the applet is implemented with a .cpl file.
This syntax has changed in Windows Vista. Many of the files that are .cpl files in Windows XP are now implemented as Shell folder applets. For example, desk.cpl is replaced with the Personalization applet and nusrmgr.cpl is replaced with the User Accounts.
The way to access these new in-frame applets is with this new syntax using the canonical name. To access the Personalization applet, for example, you use control.exe /name Microsoft.Personalization. To access the user accounts applet, you use control.exe /name Microsoft.UserAccounts.
The following lists all the canonical names of applets that ship with Windows Vista.
Microsoft.AddHardware
Microsoft.AdministrativeTools
Microsoft.AudioDevicesAndSoundThemes
Microsoft.AutoPlay
Microsoft.BackupAndRestoreCenter
Microsoft.BitLockerDriveEncryption
Microsoft.Bluetooth
Microsoft.CardSpace
Microsoft.ColorManagement
Microsoft.DateAndTime
Microsoft.DefaultPrograms
Microsoft.DeviceManager
Microsoft.EaseOfAccessCenter
Microsoft.FolderOptions
Microsoft.Fonts
Microsoft.GameControllers
Microsoft.GetPrograms
Microsoft.GetProgramsOnline
Microsoft.IndexingOptions
Microsoft.Infrared
Microsoft.InternetOptions
Microsoft.iSCSIInitiator
Microsoft.Keyboard
Microsoft.MobilityCenter
Microsoft.Mouse
Microsoft.NetworkAndSharingCenter
Microsoft.OfflineFiles
Microsoft.ParentalControls
Microsoft.PenAndInputDevices
Microsoft.PeopleNearMe
Microsoft.PerformaceInformationAndTools
Microsoft.Personalization
Microsoft.PhoneAndModemOptions
Microsoft.PowerOptions
Microsoft.Printers
Microsoft.ProblemReportsAndSolutions
Microsoft.ProgramsAndFeatures
Microsoft.RegionalAndLanguageOptions
Microsoft.ScannersAndCameras
Microsoft.SecurityCenter
Microsoft.SpeechRecognitionOptions
Microsoft.SyncCenter
Microsoft.System
Microsoft.TabletPCSettings
Microsoft.TaskbarAndStartMenu
Microsoft.TextToSpeech
Microsoft.UserAccounts
Microsoft.WelcomeCenter
Microsoft.WindowsAnytimeUpgrade
Microsoft.WindowsDefender
Microsoft.WindowsFirewall
Microsoft.WindowsSideShow
Microsoft.WindowsSidebarProperties
Microsoft.WindowsUpdate
Software developers can add to this list if they add their own applet to Control Panel. These canonical names are easy to understand and easy to remember.
Now, in Windows Vista, you can add your own applet to Control Panel by creating an executable for your applet and registering it, instead of going through the trouble of creating a .cpl file.