共用方式為


建立控制面板專案的可搜尋工作連結

從 Windows Vista 開始,[控制面板] 類別檢視會在每個 [控制面板] 專案的圖示下方提供工作連結,如下所示。

系統和維護類別頁面上的工作連結

當使用者在視窗右上方的 [搜尋] 方塊中輸入文字時,搜尋結果會包含這些任務連結。如同這裡顯示的,以「display」這個字進行搜尋。

控制面板搜尋結果中的 工作連結

本主題討論下列事項:

建議您為控制面板專案提供工作連結,以協助用戶搜尋功能。 您也可以將關鍵詞新增至工作連結,讓使用者即使在不知道工作的標題或術語的情況下也能找到關鍵詞。

最佳工作連結有三個用途:

  1. 提供 [控制面板] 項目功能的快捷方式。
  2. 提供關鍵詞,讓使用者可以使用自己的語言進行搜尋。 使用者可能會想要輸入「壓縮」,因為他或她知道技術術語。 使用者可能會輸入「資料庫太大」或「資料庫檔案大小」。 將適當的關鍵詞新增至工作表示使用者可以找到您的 [控制面板] 專案。
  3. 提供有關控制面板項目功能的提示。 當使用者看到 [控制面板] 項目圖示下方的連結時,他們可以獲得比單靠名稱和圖示提供的更多關於 [控制面板] 項目用途的資訊。

工作連結應該是使用者焦點,而不是以技術或功能為焦點。 例如,「啟用資料庫壓縮」會是錯誤的措辭,因為它是對大多數使用者不熟悉的技術術語。 「使我的資料庫檔案變得更小」較好,因為它提到使用者的實際最終目標,而不是達到目標的機制。 目標是不要過度簡化,而是以使用者想要完成的工作來表達工作。

建立工作 XML 檔案

工作連結定義於 XML 檔案中。 本節提供範例 .xml 檔案的詳細數據,該檔案會定義名為 [記事本]之 [控制面板] 專案的三個工作連結。 它會定義工作連結的標題、關鍵詞和命令行。 它也說明如何指定哪些工作連結出現在哪個類別之下。 註冊為出現在多個類別中的 [控制面板] 專案,可以選擇根據類別顯示不同的連結。 提供之各種元素和信息的說明會以 XML 本身的批註的形式提供。

<?xml version="1.0" ?>
<applications xmlns="http://schemas.microsoft.com/windows/cpltasks/v1" 
              xmlns:sh="http://schemas.microsoft.com/windows/tasks/v1">
    
    <!-- Notepad -->
    <application id="{00001111-aaaa-2222-bbbb-3333cccc4444}"> 
    <!-- This GUID must match the GUID you created for your Control Panel item,
         and registered in namespace -->
    
        <!-- Solitaire -->
        <sh:task id="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}"> 
            <!-- This is a generated GUID, specific to this task link -->
            <sh:name>Play solitaire</sh:name>
            <sh:keywords>solitare;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}" needsElevation="true"> 
            <!-- This is a generated GUID, specific to this task link -->
            <!-- The needsElevation="true" attribute means that the task 
                 appears with a shield icon next to it. Adding this attribute 
                 does not cause the .exe to require elevation - it just adds an 
                 icon to tell users that the command already requires it -->
            <sh:name>See running processes</sh:name>
            <sh:keywords>taskmgr;taskman;running processes;threads;cpu;</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;ActiveX;plug-in;plugin</sh:keywords>
            <sh:command>iexplore.exe</sh:command>
        </sh:task>
        
        <!-- Category assignments -->

        <!-- Appearance and Personalization -->
        <category id="1"> 
        <!-- These idref attributes refer to the GUIDs of the tasks defined above. A maximum of five tasks are shown per category. -->
            <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>
        
        <!-- Programs -->
        <category id="8"> 
            <sh:task idref="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}">
                <sh:name>Click here to play</sh:name>
                <!-- This overrides the defined text. When the Notepad Control 
                     Panel item appears in the Programs category, it uses the 
                     "Click here to play" text for this Solitaire link, instead 
                     of "Play solitaire". -->
            </sh:task>
            <sh:task idref="{BF46D6AA-B5E6-4EE1-9E5B-ED017272B9F9}"/>
            <sh:task idref="{DE3A6DCC-C18A-4BBF-9227-11856D7B4422}"/>
       </category>
   </application>
</applications>

注意

從 Windows 7 開始,控制面板專案可以透過標準名稱而非可執行檔名稱來識別:<sh:controlpanel> 專案可用來取代 <sh:command> <sh:controlpanel> 元素也提供屬性來指定專案應該開啟的頁面。 下列顯示 <sh:controlpanel> 專案的範例:

 

<sh:controlpanel name="Microsoft.Presentation" page="pageWallpaper"/>

工作連結標題和關鍵詞的文字可以儲存在控制面板專案模組的字串數據表中。 在這裡情況下,XML 檔案中使用的格式會變成:

<sh:task id="{3B75A7AE-C4E4-4E5A-9420-7CECCDA75425}"> 
    <!-- This is a generated GUID, specific to this task link -->
    <sh:name>@myTextResources.dll,-100</sh:name>
    <sh:keywords>@myTextResources.dll,-101</sh:keywords>
    <sh:command>%ProgramFiles%\Microsoft Games\Solitaire\solitaire.exe</sh:command>
</sh:task>

在此範例中,工作名稱的文字會出現在字串資源標識碼 100 中,myTextResources.dll中,關鍵詞的文字會出現在字元串資源標識元 101 中。

關鍵詞和搜尋

[控制面板] 搜尋會根據工作連結的名稱以及其關鍵詞來尋找工作連結。 它會將搜尋中的每個單字與名稱和關鍵詞中的單字前綴進行比對。 例如,查詢字串 「cpu」 會比對先前範例中「查看執行中的進程」工作,因為 「cpu」 位於關鍵詞清單中。 查詢字串 「pro」 也會發現該結果,因為標題字 「processes」 以該字串開頭。 請注意,查詢只匹配前綴。 查詢字串「rocess」與結果不符,因為該字串雖然是標題詞「process」的一部分,但並不是該詞的開頭。

當搜尋查詢包含多個令牌時,所有令牌都必須符合結果中某些關鍵詞或部分工作標題的前置詞。 查詢 「cpu level」 不相符,因為 「level」 不在關鍵詞集中。 查詢 「cpu run」 會提供結果,因為 「cpu」 符合關鍵詞,而 「run」 是工作標題中 「running」 一詞的前置詞。

控制面板不會自動提供拼字校正或變化,例如複數或連字元。 相符結果不區分大小寫。 若要確保關鍵詞清單成功,建議您自行提供變化,例如針對包含螢幕保護程式的工作連結:“screensavers;screen-savers;屏幕保護程式;”

不需要新增單數形式的「screensaver」,因為尋找「screensavers」的查詢也會因為前綴匹配而找到「screensaver」。 即使使用者只輸入部分詞語,如「screensa」,仍然會在包含「screensavers」作為關鍵字的任務連結中看到相符的結果。 對於複數形式會改變單字的語言,必須將所有使用者可能合理輸入的形式納入關鍵字中。

作為慣例,Microsoft會省略出現在關鍵字中的某些短語,如「如何」或「我想」等。 預期大部分的使用者只會輸入最重要的單字,例如 “mouse”、“high contrast” 或 “video driver” 來取得結果。

控制面板項目

用戶體驗指導方針

註冊控制面板項目

使用 CPLApplet

控制面板訊息處理

執行控制面板專案

擴充系統控制面板項目

指派控制面板類別

在 Windows Vista 下以安全模式存取控制面板