How to register a CPL file so that it can be displayed in the control panel

Source: Internet
Author: User
Tags at sign xslt
Registering Control Panel items

Control
Panel items must be registered in order to appear in the control panel
Window. If the control panel item is implemented as part of a. EXE file
Then it is registered as a command object. Registration differs if
Item is implemented as a. dll file that exports the cplapplet function.

Specific requirements are discussed in these sections.

  • Executable Control Panel item registration
  • Dll Control Panel item registration
  • Related Topics
Executable Control Panel item registration

For
Control Panel items implemented as. EXE files, no special exports or
Message Handling is required. Any. EXE file can be registered as
Command object to appear with an entry point in the control panel
Folder.

An example is used here to demonstrate the registration
Requirements. The example shows how to register a control panel item
CalledMy settingsAs a command object so it appears in the control panel window.My settingsWindow also appears when the commandMyApp.exe /settingsIs run.

  1. Generate a guid for the Control Panel item. In this example,{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}Is the guid of the Control Panel item. The GUID uniquely identifies the control panel item.
  2. Add the following information to the Registry.
    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Explorer
                • Controlpanel
                  • Namespace
                    • {0052d9fc-6764-4d29-a66f-2f3bd9e2bb40}
                    • (Default) = my settings

    The
    Data for the default entry is simply the name of the Control Panel
    Item. The default entry can be a useful tag when someone is examining
    The Registry, but it is optional.

  3. Add the following information to the Registry.
    • Hkey_classes_root
      • CLSID
        • {0052d9fc-6764-4d29-a66f-2f3bd9e2bb40}
        • (Default) = [REG_SZ] My settings
          Localizedstring=[Reg_expand_sz] @ % ProgramFiles %/mycorp/myapp.exe,-9
          Infotip=[Reg_expand_sz] @ % ProgramFiles %/mycorp/myapp.exe,-5
          System. applicationname=[REG_SZ] mycorporation. mysettings
          System. controlpanel. Category=[REG_SZ] 1,8
          System. Software. tasksfileurl=[REG_SZ or reg_expand_sz] % ProgramFiles %/mycorp/MyApp/mytasklinks. xml

    • Default. The display name for the Control Panel item.
    • Localizedstring.
      Optional. The module name and string table ID of the localized name
      The control panel item. The format is an at sign (@) followed by
      Name of the. exe or. dll that contains the Multilingual user interface
      (Mui) string table. environment variables can be used as a substitute
      For a part of the path. That is followed by a comma (,) and a hyphen
      (-), Followed by the ID in the string table. If the module does not
      Have a string table then this value can simply be the display name
      String. If you use only the display name string rather than a string
      Table, the name does not adjust to the current display language.
    • Infotip.
      A description of the Control Panel item. This is displayed in
      Infotip that is displayed when the mouse hovers over the item's icon.
      The syntax is the same as that used for localizedstring, including
      Option of simply providing a string rather than a string table
      Reference.
    • System. applicationname. The canonical name of the item. The commandcontrol.exe /name MyCorporation.MySettingsWill open the item. See executing control panel items.
    • System. controlpanel. Category.
      A value that declares the categories where the item appears. Multiple
      Categories are separated by commas. In this case, it specifies that
      My settingsItem shoshould appear inAppearance and personalizationCategory and alsoProgramsCategory. See assigning Control Panel categories for possible values.
    • System. Software. tasksfileurl. The path of the XML file that defines task links.
      This can be a path as shown in the example, or an embedded Resource
      Specified as a module name and resource ID such
      "% ProgramFiles %/mycorp/MyApp/myapp.exe,-31 ".
  4. Add
    Following information to the Registry to provide the path of the file
    That contains the icon and the resource ID of the image within that
    File.
    • Hkey_classes_root
      • CLSID
        • {0052d9fc-6764-4d29-a66f-2f3bd9e2bb40}
          • Defaulticon
          • (Default) = [reg_expand_sz] % ProgramFiles %/mycorp/myapp.exe,-2

    Note
    That while the syntax is otherwise similar to localizedstring and
    Infotip discussed earlier, no @ character is used as a prefix.

  5. Add the following information to the Registry to provide the command called by the system when the user opens the control panel.
    • Hkey_classes_root
      • CLSID
        • {0052d9fc-6764-4d29-a66f-2f3bd9e2bb40}
          • Shell
            • Open
              • Command
              • (Default) = [reg_expand_sz] % ProgramFiles %/mycorp/myapp.exe/settings

Dll Control Panel item registration

Control Panel items implemented in a DLL that exportsCplapplet
Function have different registration requirements than. EXE files.
Microsoft Windows 2000 and later systems, new control panel item DLLs
Shocould be installed in the associated application's folder under
Program Files Folder. items stored in the System32 directory with
. Cpl extension do not need to be registered; they are automatically
Shown in the control panel. All other control panel items usingCplappletMust be registered in one of two ways:

  • If the control panel item is to be available to all users, register the path on a per-Computer basis by addingREG_EXPAND_SZValue to

    HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Control Panel/Cpls
    Key, set to the dll path.

  • If the control panel item is to be available on a per-user basis, useHKEY_CURRENT_USER
    As the root key insteadHKEY_LOCAL_MACHINE
    .

The following two examples registerMycplappControl Panel item. The DLL is named mycpl. CPL and is located inMycorp/MyAppApplication directory. This first example extends strates per-computer registration.

  1. Add this information to the Registry to register the existence of the. Cpl file.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Cpls
                • Mycpl=[Reg_expand_sz] % ProgramFiles %/mycorp/MyApp/mycpl. CPL

  2. Windows Vista and later:Add this additional information to the Registry to provide a guid for the Control Panel item.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Extendedproperties
                  • System. Software. appid
                  • % ProgramFiles %/mycorp/MyApp/mycpl. CPL={A newly generated guid}

    By
    Generating a guid to uniquely identify the control panel item, you can
    Add task links to the control panel. Without this GUID, there is no way
    For the task links to be associated with the control panel item. SeeCreating searchable task links for a control panel item.

  3. Windows Vista and later:Add the following information to the Registry to create a canonical name for the item.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Extendedproperties
                  • System. applicationname
                  • % ProgramFiles %/mycorp/MyApp/mycpl. CPL=[REG_SZ] mycorporation. mycpl

    By adding a canonical name, users can launch the control panel item from a command line by enteringcontrol.exe /name MyCorporation.MyCpl.
    This also makes it possible to change an implementation from a. CPL
    File to A. EXE file later, without requiring calling programs to make
    Any changes since they can continue opening the item through its
    Canonical name. For more information on Canonical names, seeExecuting Control Panel items.

  4. Windows Vista and later:Add the following information to the Registry to assign a control panel item to one or more categories.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Extendedproperties
                  • System. controlpanel. Category
                  • % ProgramFiles %/mycorp/MyApp/mycpl. CPL=[REG_DWORD] 3

    Windows XP:Add the following information to the Registry to assign a control panel item to one or more categories.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Extendedproperties
                  • {305ca226-d286-468e-b848-2b2e8e697b74} 2
                  • % ProgramFiles %/mycorp/MyApp/mycpl. CPL=[REG_DWORD] 3

    This
    Example assigns the item to Category 3, which is network and Internet.
    To add an item to multiple categories, provide the List as a REG_SZ
    Value separated by commas, such as "3, 8". values can be provided
    Either decimal or hexidecimal. Note that the ability to add an item
    Multiple Categories is only possible in Windows XP Service Pack 2 (SP2)
    And later. SeeAssigning Control Panel categoriesFor all possible values.

  5. Windows Vista and later:
    Add the following information to the Registry to create and point to
    XML file to hold task links for the item. The value must be a REG_SZ
    Path as shown here or a module and resource ID (for example,
    "C:/program files/mycorp/MyApp/myapp.exe,-31") if it is an embedded
    Resource. The location of the XML file shocould be fully specified. it
    Cannot use an environment variable such as % ProgramFiles %.

    • HKEY_LOCAL_MACHINE
      • Software
        • Microsoft
          • Windows
            • CurrentVersion
              • Control Panel
                • Extendedproperties
                  • System. Software. tasksfileurl
                  • % ProgramFiles %/mycorp/MyApp/mycpl. CPL=[REG_SZ] C:/ProgramFiles/mycorp/MyApp/mytasks. xml

    For more details on task links and how to create the XML file to hold them, seeCreating searchable task links for a control panel item.

For systems prior to Windows 2000, new control panel items must be set up in one of the following ways:

  • Copy the DLL to the directory that contains the Windows system utility.
  • Copy the DLL to the Windows System directory.
  • Write the path of the DLL using the writeprivateprofilestring
    Function, specifying the string "mmcpl" as the section name and
    String "control. ini" as the file name (no path). Do not actually write
    Directly to the control. ini file. Instead, useWriteprivateprofilestring
    Function, which automatically handles differences among platforms.
    Following example demonstrates how you wocould set up the path
    Mycpl. Cpl. Copy code
    WritePrivateProfileString("MMCPL", "MyCpl.cpl", "C://mydir//MyCpl.cpl", "control.ini");

    Note
    Control. ini
    Can also restrict which control panel items are loaded. It is not
    Recommended that applications alter control. ini for this purpose.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.