uuid (C++)uuid (C++)
Microsoft 固有の仕様Microsoft Specific
コンパイラは、 uuid属性を使用して、宣言または定義された (完全な COM オブジェクト定義のみ) クラスまたは構造体に GUID をアタッチします。The compiler attaches a GUID to a class or structure declared or defined (full COM object definitions only) with the uuid attribute.
構文Syntax
__declspec( uuid("ComObjectGUID") ) declarator
RemarksRemarks
Uuid属性は、引数として文字列を受け取ります。The uuid attribute takes a string as its argument. この文字列は、 {} 区切り記号の有無に関係なく、通常のレジストリ形式で GUID に名前を付けます。This string names a GUID in normal registry format with or without the { } delimiters. 例えば:For example:
struct __declspec(uuid("00000000-0000-0000-c000-000000000046")) IUnknown;
struct __declspec(uuid("{00020400-0000-0000-c000-000000000046}")) IDispatch;
この属性は、再宣言で適用できます。This attribute can be applied in a redeclaration. これにより、システムヘッダーはなどのインターフェイスの定義、 IUnknown
および他のヘッダー ( <comdef .h > など) の再宣言によって GUID を指定できます。This allows the system headers to supply the definitions of interfaces such as IUnknown
, and the redeclaration in some other header (such as <comdef.h>) to supply the GUID.
__Uuidofキーワードを適用して、ユーザー定義型にアタッチされている定数 GUID を取得できます。The keyword __uuidof can be applied to retrieve the constant GUID attached to a user-defined type.
Microsoft 固有の仕様はここまでEND Microsoft Specific
関連項目See also
フィードバック
フィードバックを読み込んでいます...