List 2-5 IUnknownインタフェースのビルドに必要なマクロ
1: #include "stdafx.h"
2:
3: // IUnknownインタフェースをビルドするのに必要なマクロ
4: #define HRESULT long
5: #define ULONG unsigned long
6: #define PLONG unsigned long*
7: #define DWORD unsigned long
8: #define WORD unsigned short
9: #define BYTE unsigned char
10: #define BOOL long
11:
12: typedef struct _GUID
13: {
14: DWORD Data1;
15: WORD Data2;
16: WORD Data3;
17: BYTE Data4[8];
18: } GUID;
19:
20: typedef GUID CLSID;
21: typedef GUID IID;
22: #define REFCLSID const CLSID &
23: #define REFIID const IID &
24:
25: // Unknownインタフェースの定義
26: // IID_IUnknown {00000000-0000-0000-C000-000000000046}
27: static const IID IID_IUnknown =
28: { 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
29:
30: class IUnknown
31: {
32: public:
33: virtual HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj) = 0;
34: virtual ULONG __stdcall AddRef() = 0;
35: virtual ULONG __stdcall Release() = 0;
36: };
37:
38: int main(int argc, char* argv[])
39: {
40: return 0;
41: }