이 블로그 검색

2014년 6월 12일 목요일

제어판 EXE 등록 방법

밑 두곳 참고하면 가능하다. MSDN은 진리

http://msdn.microsoft.com/ko-kr/library/bb757044.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/hh127450(v=vs.85).aspx

How to Register Executable Control Panel Items

For Control Panel items that are implemented as .exe files, no special exports or message handling is required. Any .exe file can be registered as a 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 called My Settings as a command object so that it appears in the Control Panel window. The My Settingswindow also appears when the command MyApp.exe /settings is run.

Instructions

Step 1:

Generate a GUID for the Control Panel item. The GUID uniquely identifies the Control Panel item. In this example,{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40} is the GUID of the Control Panel item.

Step 2:

Using the GUID as a name, add a subkey to the registry as follows.
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 REG_SZ name of the Control Panel item. The Default entry can be useful to identify the GUID entry, but it is optional.

Step 3:

Using the GUID as a name, add a subkey and its entries to the registry as follows.
HKEY_CLASSES_ROOT
   CLSID
      {0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
         (Default) = My Settings
         LocalizedString = @%ProgramFiles%\MyCorp\MyApp.exe,-9
         InfoTip = @%ProgramFiles%\MyCorp\MyApp.exe,-5
         System.ApplicationName = MyCorporation.MySettings
         System.ControlPanel.Category = 1,8
         System.Software.TasksFileUrl = %ProgramFiles%\MyCorp\MyApp\MyTaskLinks.xml
  • Default. REG_SZ. The display name for the Control Panel item.
  • LocalizedString. Optional. REG_SZ or REG_EXPAND_SZ. The module name and string table ID of the localized name of the Control Panel item. The format is an "at" sign (@) followed by the 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. The path and file name 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 entry 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. REG_SZ or REG_EXPAND_SZ. A description of the Control Panel item. This information is shown in an InfoTip that is displayed when the mouse hovers over the item's icon. The syntax is the same as that used for LocalizedString, including the option of simply providing a string rather than a string table reference.
  • System.ApplicationName. REG_SZ. The canonical name of the item. The command of form control.exe /name System.ApplicationName opens the item; for example, control.exe /name MyCorporation.MySettings. See Executing Control Panel Items for more information on the use of Control.exe.
  • System.ControlPanel.Category. REG_SZ. A value that declares the Control Panel categories where the item appears. Multiple categories are separated by commas. In the case of the example above, the entry specifies that the My Settingsitem should appear in both the Appearance and Personalization and Programs categories. See Assigning Control Panel Categories for possible category values.
  • System.Software.TasksFileUrl. REG_SZ or REG_EXPAND_SZ. The path of the XML file that defines task links. This can be a direct file path as shown in the example, or an embedded resource specified as a module name and resource ID such as "%ProgramFiles%\MyCorp\MyApp\MyApp.exe,-31".

Step 4:

Under that same GUID subkey, add the following subkey 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) = %ProgramFiles%\MyCorp\MyApp.exe,-2
Note that while the syntax is otherwise similar to the LocalizedString and InfoTip entries discussed earlier, no '@' character is used as a prefix in the REG_SZ or REG_EXPAND_SZ entry that specifies the path.

Step 5:

Add the following information to the registry to provide the command that is 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

Related topics





사용자 애플릿과 작업 추가 및 등록

Windows Vista에서는 제어판에 애플릿을 추가하기가 더 쉬워졌습니다. 소프트웨어 개발자는 이제 손쉽게 자신의 애플릿 및 작업을 제어판에 추가할 수 있습니다.
이전 버전의 Windows에서는 Windows 레지스트리와 CplApplet 함수를 사용하여 제어판에 애플릿을 추가했습니다. 운영 체제에서는 레지스트리를 사용하여 애플릿이 포함된 모듈을 열거합니다. 각 모듈의 CplApplet 함수가 호출되어 애플릿과 해당 아이콘 및 설명을 표시하고 애플릿을 호출합니다. 이 프로세스는 애플릿이 CplApplet 인터페이스를 구현해야 하므로 명령 개체를 이용하는 것보다 복잡합니다. 이 프로세스는 Windows Vista에서도 지원되지만 구현하기 더 쉬운 명령 개체를 사용하는 것이 좋습니다.
Windows Vista에서는 실행 파일(.exe)을 작성하고 이를 명령 개체로 등록하기만 하면 제어판에 애플릿이 표시됩니다. 예를 들어 CplApplet 인터페이스를 구현하고 바이너리를 수정하는 지루한 작업을 수행할 필요 없이 애플릿에 대한 MySystemApplet.exe 실행 파일을 작성하고, MySystemApplet.exe를 셸 명령 개체로 등록하기만 하면 제어판에 애플릿을 추가할 수 있습니다.
다음 코드 샘플은 MySystemApplet.exe 애플릿을 명령 개체로 등록하고 이 애플릿을 제어판에 추가합니다.
MySystemApplet.exe 애플릿을   명령   개체로   등록하고      애플릿을   제어판에   추가하려면  
  1. 명령 개체에 대한 새 GUID를 만듭니다. 이 예에서는 새 GUID로 {0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}을 사용합니다.
  2. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}의 값을 MySystemApplet. Default Value = "MySystemApplet"으로 설정한 다음 GUID를 사용자의 GUID로 바꿉니다.
  3. HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}을 다음 값으로 설정합니다.
    // 애플릿의 표시 이름을 설정합니다.
    (Default value) as REG_SZ = "MySystemApplet"
    // 애플릿의 정식 이름을 설정합니다.  
    System.ApplicationName as Reg_sz = "MyCompany.MySystemApplet"  
    // control.exe /name MyCompany.MySystemApplet을 호출하면 애플릿이 시작됩니다.
    // 모양 및 개인 설정과 프로그램 범주에 애플릿을 추가합니다. 
    System.ControlPanel.Category as Reg_sz = "1,8"
    // 애플릿의 모듈 이름과 문자열 테이블 ID를 정의합니다. 
    형식은 "@" 기호로 시작하여 그 뒤에 MUI 문자열 테이블을 
    포함하는 .exe 또는 .dll, 그 다음 "-", 그리고 문자열 테이블의 
    ID 순서입니다. 애플릿에 문자열 테이블이 없는 경우에는 
    이 형식은 텍스트만 포함할 수도 있습니다. 이 경우 이름은 
    지역화되지 않습니다.
    LocalizedString as Reg_expand_sz = "@%SystemRoot%\MySystemApplet.exe,-9"  
    // LocalizedString과 같은 형식입니다.  
    InfoTip as reg_expand_sz = "@%SystemRoot%\MySystemApplet.exe,-5"
  4. HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}의 기본 아이콘을 설정합니다.
    // DefaultIcon을 기본값으로 설정합니다. 2는 아이콘의 리소스 ID를 나타냅니다(기본값). 
    reg_expand_sz = "%SystemRoot%\MySystemApplet.exe,-2"
  5. HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-
    A66F-2F3BD9E2BB40}\Shell\Open\Command에 대한 명령을 설정합니다.
    // 아이콘이 호출될 때 호출할 명령을 지정합니다(기본값). reg_expand_sz = "%ProgramFiles%\MyCompany\MySystemApplet.exe"
  6. HKEY_CLASSES_ROOT\CLSID\{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}에서(여기에서 GUID는 애플릿을 등록하는 데 사용한 GUID) System.Software.TasksFileUrl. "System.Software.TasksFileUrl" 값을 reg_expand_sz = "C:\\test\\MySystemApplettasks.xml"로 설정하여 "System.Software.TasksFileUrl" 레지스트리 값이 설치한 작업 XML의 위치를 가리키도록 합니다. 아래의 샘플 코드는 작업 XML 파일의 예제입니다.
    다음 표에서는 Windows Vista의 각 제어판 범주를 나타내는 값을 나열합니다.
범주 아이콘 표시 위치
1
모양 및 개인 설정
2
하드웨어 및 소리
3
네트워크 및 인터넷
4
사용되지 않음
5
시스템 및 유지 관리
6
시계, 언어 및 국가별 옵션
7
내게 필요한 옵션
8
프로그램
9
사용자 계정 및 가족 보호(비즈니스 릴리스 및 Ultimate에서는 도메인 가입 시 "사용자 계정"으로만 표시)
10
보안
11
이동 PC(이 범주는 랩톱 컴퓨터에서만 표시)
다음 코드 샘플은 XML 파일의 작업을 정의합니다. "System.Software.TasksFileUrl" 레지스트리가 이 XML 파일을 가리키도록 설정할 수 있습니다.
<?xml version="1.0" ?>
<applications xmlns="http://schemas.microsoft.com/windows/cpltasks/v1" 
xmlns:sh="http://schemas.microsoft.com/windows/tasks/v1">
    <!-- MySystemApplet -->
    <application id="{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}">  
<!-- 이 GUID는 애플릿에 대해 만들어 네임스페이스에 등록한 GUID와 일치해야 합니다. -->
        <!-- 카드놀이 -->
        <sh:task id="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}"> 
<!-- 이 작업만을 위해 만들어진 GUID입니다. -->
              <sh:name>Play solitaire</sh:name>              <sh:keywords>game;cards;ace;diamond;heart;club;single</sh:keywords>
              <sh:command>%ProgramFiles%\Microsoft Games\Solitaire\solitaire.exe</sh:command>
        </sh:task>
        <!-- Task Manager -->
        <sh:task id="{BF46D6AA-B5E6-4EE1-9E5B-ED017272B9F9}">  <!-- 이 작업을 위해 만들어진 GUID -->
             <sh:name>Run Task Manager</sh:name>            <sh:keywords>taskmgr;taskman;programs;processes;threads;cpu;utilization</sh:keywords>
              <sh:command>taskmgr.exe</sh:command>
        </sh:task>
   <!-- IE -->
        <sh:task id="{DE3A6DCC-C18A-4BBF-9227-11856D7B4422}">
              <sh:name>Open Internet Explorer</sh:name>
<sh:keywords>IE;web;browser;net;Internet;Netscape;Trident;ActiveX;plug-in;plugin</sh:keywords>
              <sh:command>iexplore.exe</sh:command>
        </sh:task>
        <category id="1"> <!-- 모양 및 테마 -->
  <!-- 이 idref 항목은 위에 정의된 작업의 GUID를 참조합니다. 
"3B7.."은 카드놀이, "BF4.."는 작업 관리자, "DE3.."은 
Internet Explorer입니다.-->
       <sh:task idref="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}" />   
       <sh:task idref="{BF46D6AA-B5E6-4EE1-9E5B-ED017272B9F9}" />
       <sh:task idref="{DE3A6DCC-C18A-4BBF-9227-11856D7B4422}" />
   </category>
       <category id="8"> <!-- 프로그램 -->
       <sh:task idref="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}">
                  <sh:name>Click here for fun</sh:name>
      <!-- "다시 정의 이름"을 표시합니다. MySystemApplet 애플릿이 
프로그램 범주에 표시되면 이 카드놀이 링크에 대해 "Play solitaire" 대신 
"Click here for fun" 텍스트를 사용하게 됩니다. -->
       </sh:task>
       <sh:task idref="{BF46D6AA-B5E6-4EE1-9E5B-ED017272B9F9}" />
       <sh:task idref="{DE3A6DCC-C18A-4BBF-9227-11856D7B4422}" />
   </category>
    </application>
</applications> 

제어판 애플릿을 열기 위한 새로운 구문

Windows Vista는 코드 및 시작->실행 메뉴에서 간단하고 이해하기 쉬운 각 애플릿의 정식 이름을 지정하여 제어판 애플릿을 열 수 있는 새로운 구문을 제공합니다. 구현이나 파일 이름이 바뀌더라도 정식 이름은 그대로 유지되므로 이러한 새 정식 이름은 애플릿에 액세스하기 위한 가장 좋은 방법입니다. 예를 들어 이전 버전의 Windows에서는 Internet Explorer 제어판 애플릿인 인터넷 속성을 시작하려면 Control.exe inetcpl.cpl 구문을 사용합니다. 이 구문은 애플릿을 .cpl 파일로 구현한 경우에만 작동합니다.
이 구문은 Windows Vista에서 변경되었습니다. Windows XP의 많은 .cpl 파일이 이제 셸 폴더 애플릿으로 구현됩니다. 예를 들어 desk.cpl은 개인 설정 애플릿으로 대체되었으며 nusrmgr.cpl은사용자 계정으로 대체되었습니다.
이러한 새 인-프레임 애플릿에 액세스하는 방법은 정식 이름을 사용하는 새 구문을 사용하는 것입니다. 예를 들어 개인 설정 애플릿에 액세스하려면 control.exe /name Microsoft.Personalization을 사용합니다. 사용자 계정 애플릿에 액세스하려면 control.exe /name Microsoft.UserAccounts를 사용합니다. 
다음은 Windows Vista와 함께 제공되는 모든 애플릿의 정식 이름입니다.
Microsoft.AddHardware
Microsoft.PenAndInputDevices
Microsoft.AdministrativeTools
Microsoft.PeopleNearMe
Microsoft.AudioDevicesAndSoundThemes
Microsoft.PerformaceInformationAndTools
Microsoft.AutoPlay
Microsoft.Personalization
Microsoft.BackupAndRestoreCenter
Microsoft.PhoneAndModemOptions
Microsoft.BitLockerDriveEncryption
Microsoft.PowerOptions
Microsoft.Bluetooth
Microsoft.Printers
Microsoft.CardSpace
Microsoft.ProblemReportsAndSolutions
Microsoft.ColorManagement
Microsoft.ProgramsAndFeatures
Microsoft.DateAndTime
Microsoft.RegionalAndLanguageOptions
Microsoft.DefaultPrograms
Microsoft.ScannersAndCameras
Microsoft.DeviceManager
Microsoft.SecurityCenter
Microsoft.EaseOfAccessCenter
Microsoft.SpeechRecognitionOptions
Microsoft.FolderOptions
Microsoft.SyncCenter
Microsoft.Fonts
Microsoft.System
Microsoft.GameControllers
Microsoft.TabletPCSettings
Microsoft.GetPrograms
Microsoft.TaskbarAndStartMenu
Microsoft.GetProgramsOnline
Microsoft.TextToSpeech
Microsoft.IndexingOptions
Microsoft.UserAccounts
Microsoft.Infrared
Microsoft.WelcomeCenter
Microsoft.InternetOptions
Microsoft.WindowsAnytimeUpgrade
Microsoft.iSCSIInitiator
Microsoft.WindowsDefender
Microsoft.Keyboard
Microsoft.WindowsFirewall
Microsoft.MobilityCenter
Microsoft.WindowsSideShow
Microsoft.Mouse
Microsoft.WindowsSidebarProperties
Microsoft.NetworkAndSharingCenter
Microsoft.WindowsUpdate
Microsoft.OfflineFiles

Microsoft.ParentalControls

소프트웨어 개발자는 제어판에 자신의 애플릿을 추가하는 경우 이 목록에 이름을 추가할 수 있습니다. 이러한 정식 이름은 이해하고 기억하기 쉽습니다.
이제 Windows Vista에서는 어렵게 .cpl 파일을 만들 필요 없이 애플릿에 대한 실행 파일을 만들고 이를 등록하는 방법으로 제어판에 자신의 애플릿을 추가할 수 있습니다.

댓글 없음:

댓글 쓰기