coclass 屬性

coclass語句提供元件物件的支援介面清單。

[
    coclass-attribute-list
]
coclass classname
{
    [
        interface-attributes
    ] 
    [interface | dispinterface] interfacename 
    {
  . . . 
    }
}

參數

coclass-attribute-list

coclass上需要[uuid]屬性。 這是在系統註冊資料庫中註冊為 CLSID 的相同 [uuid ]。 在coclass定義之前,會接受[helpstring][helpcoNtext][licensed][version][control][hidden][appobject]屬性,但不需要。

classname

在類型程式庫中已知通用物件的名稱。

interface-attributes

介面或 dispinterface 的選擇性屬性。 在coclass內的介面或 dispinterface 上接受[source][default][restricted]屬性。

interfacename

使用 interface 關鍵字宣告的介面,或使用 dispinterface 關鍵字宣告的 dispinterface

備註

Microsoft Component Object Model 會將類別定義為實作,以允許一組介面之間的 QueryInterface

範例

[
    uuid(1e196b20-1f3c-1069-996b-00dd010fe676), 
    version(1.0), 
    helpstring("A class"), 
    helpcontext(2481), appobject
] 
coclass myapp 
{ 
    [source] interface IMydocfuncs : IUnknown; 
    dispinterface DMydocfuncs; 
}; 
 
[
    uuid(12345678-1234-1234-1234-123456789ABC)
] 
coclass mycoclass 
{ 
    [restricted] interface iface1; 
    interface iface2; 
}

另請參閱

appobject

控制

預設值

dispinterface

使用 MIDL 產生類型程式庫

ODL 檔案範例

helpstring

helpcontext

隱藏

介面

licensed

ODL 檔案語法

限制

TYPEFLAGS

uuid

版本