- GUID(Globally Unique Identifier)是一个16字节(128bit)的结构体。
-
1 typedef struct _GUID { // size is 16
2 DWORD Data1;
3 WORD Data2;
4 WORD Data3;
5 BYTE Data4[8];
6 } GUID; - GUID是组件(CLSID)和接口(IID)的标识号。
-
1 typedef GUID IID;
2 typedef GUID CLSID; - GUID的产生:
- VS2005:Tools--->Create GUID
- GUID的声明、定义:
- DEFINE_GUID宏:
- 若定义了INITGUID,则DEFINE_GUID为GUID定义,否则为声明
-
1 #ifndef INITGUID
2 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
3 EXTERN_C const GUID FAR name
4 #else
5
6 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
7 EXTERN_C const GUID name \
8 = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
9 #endif // INITGUID