Share via


ServiceServer) 中的 com3:Class (

定義裝載于 Com3:ServiceServer 元素中之 Windows 服務中裝載的 COM 伺服器中的類別註冊。

元素階層

<套件>

    <應用程式>

         <應用程式>

              <擴充功能>

                   <com2:Extension>

                        com2:ComServer

                             com3:ServiceServer

                                  <com3:Class>

Syntax

<com3:Class
    Id = 'A GUID in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.'
    DisplayName = 'An optional string with a value between 1 and 256 characters in length.'
    EnableOleDefaultHandler = 'An optional boolean value.'
    ProgId = 'An optional alphanumeric string separated by a period with a value between 1 and 255 characters in length (e.g. Foo.Bar or Foo.Bar.1).'
    VersionIndependentProgId = 'An optional alphanumeric string separated by a period with a value between 1 and 255 characters in length (e.g. Foo.Bar or Foo.Bar.1).'
    AutoConvertTo = 'An optional GUID in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.'
    InsertableObject = 'An optional boolean value.'
    ShortDisplayName = 'An optional string with a value between 1 and 40 characters in length.' >

  <!-- Child elements -->
  ImplementedCategories?,
  Conversion?,
  DataFormats?,
  MiscStatus?,
  Verbs?,
  DefaultIcon?,
  ToolboxBitmap32? 
  
</com3:Class>

答案

? 選擇性 (零或一個)

屬性和元素

屬性

屬性 描述 資料類型 必要 預設值
Id Id 屬性會對應至 CLSID (HKCR\CLSID{MyGuid}) 。 格式為 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx 的 GUID。 Yes
DisplayName 對應至 CLSID 索引鍵預設值的可當地語系化字串。 長度介於 1 到 256 個字元之間的選擇性字串。 No
EnableOleDefaultHandler 如果 InprocHandler32 機碼的預設值為 「Ole32.dll」,則應該將此設定為 true。 否則,應該省略它。 預設值為 false。 選擇性布林值。 No
ProgId 將程式設計識別碼 (ProgID) 與 CLSID 產生關聯。 選擇性英數位元字串,以長度介於 1 到 255 個字元之間的值分隔, (例如 Foo.Bar 或 Foo.Bar.1) 。 No
VersionIndependentProgId 建立 ProgID 與 CLSID 的關聯。 這個值是用來判斷最新版的物件應用程式。 選擇性英數位元字串,以長度介於 1 到 255 個字元之間的值分隔, (例如 Foo.Bar 或 Foo.Bar.1) 。 No
AutoConvertTo 指定將給定物件類別自動轉換成新物件類別。 xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx 格式的選擇性 GUID。 No
InsertableObject 表示這個類別是可插入的。 選擇性布林值。 No
ShortDisplayName 類別顯示名稱的簡短版本。 長度介於 1 到 40 個字元之間的選擇性字串。 No

子元素

子項目 描述
ImplementedCategories 指定 類別所實作的類別。
轉換 指定類別的讀取/寫入權限。
DataFormats 指定支援的預設和主要資料格式。
MiscStatus 指定如何建立及顯示物件。
動詞 指定要為應用程式註冊的動詞。
DefaultIcon 提供物件圖示呈現的預設圖示資訊。
ToolboxBitmap32 識別要用於工具列或工具箱按鈕之 16 x 16 點陣圖的模組名稱和資源識別碼。

父元素

父元素 描述
com3:ServiceServer 使用一或多個類別註冊來註冊 COM 伺服器 (,) 裝載于以對應 Desktop6:Service 元素宣告的 Windows 服務中。

範例

<?xml version="1.0" encoding="utf-8"?>
<Package IgnorableNamespaces="uap com com2 com3 desktop6"
         xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
         xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
         xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6"
         xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
         xmlns:com2="http://schemas.microsoft.com/appx/manifest/com/windows10/2"
         xmlns:com3="http://schemas.microsoft.com/appx/manifest/com/windows10/3">
...
    <Applications>
        <Application ...>
            <Extensions>
                <desktop6:Extension Category="windows.service" Executable="ContosoPackagedService.exe" EntryPoint="packagedServiceComServer.service">
                    <desktop6:Service Name="examplePackagedServiceComServer" StartupType="manual" StartAccount="localService" /> 
                </desktop6:Extension>
                <com2:Extension Category="windows.comServer">
                    <com2:ComServer>
                        <com3:ServiceServer ServiceName="examplePackagedServiceComServer" DisplayName="ServicePackage public service server" 
                            LaunchAndActivationPermission="O:SYG:SYD:(A;;11;;;WD)(A;;11;;;RC)(A;;11;;;AC)(A;;11;;;AN)S:P(ML;;NX;;;S-1-16-0)">
                            <com3:Class Id="1BB09D24-6A0F-4C1F-BCB5-FB924324B2F5" DisplayName="CLSID_ContosoPublicServiceNoHandler"/>
                        </com3:ServiceServer>
                        <com3:TreatAsClass Id="2DAA3C97-F340-4C0E-B23C-92338974C5E9" DisplayName="CLSID_ContosoPublicServiceTreatAs" 
                            TreatAs="1BB09D24-6A0F-4C1F-BCB5-FB924324B2F5"/>
                        <com3:ProgId Id="ContosoPublicServiceNoHandler" Clsid="1BB09D24-6A0F-4C1F-BCB5-FB924324B2F5"/>
                        <com3:ProgId Id="ContosoPublicServiceNoHandler.1" CurrentVersion="ContosoPublicServiceNoHandler"/>
                    </com2:ComServer>
                </com2:Extension>
            </Extensions>
        </Application>
    </Applications>
</Package>

規格需求

Item
Namespace http://schemas.microsoft.com/appx/manifest/com/windows10/3
OS 最低版本 Windows 10版本 2004 (組建 19041)