home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / activexcontrol / basectl / include / ipserver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-05  |  10.2 KB  |  226 lines

  1. //=--------------------------------------------------------------------------=
  2. // IPServer.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright 1995-1997 Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // global header file that contains all the windows stuff, etc ...  should
  13. // be pre-compiled to speed things up a little bit.
  14. //
  15. #ifndef _IPSERVER_H_
  16.  
  17. //#define INC_OLE2
  18. #include <windows.h>
  19. #include <stddef.h>                    // for offsetof()
  20. #include <olectl.h>
  21.  
  22. // things that -everybody- wants [read: is going to get]
  23. //
  24. #include "Debug.H"
  25.  
  26. //=--------------------------------------------------------------------------=
  27. // controls can register for thread notifications in their InitializeLibrary()
  28. //
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif // __cplusplus
  32.  
  33. typedef void (CALLBACK *THRDNFYPROC)(HANDLE, DWORD, void *);
  34. void SetLibraryThreadProc(THRDNFYPROC pfnThreadNotify);
  35.  
  36. #ifdef __cplusplus
  37. }
  38. #endif // __cplusplus
  39. //=--------------------------------------------------------------------------=
  40.  
  41. //=--------------------------------------------------------------------------=
  42. // we don't want to use the CRTs, and would like some memory tracking in the
  43. // debug case, so we'll override these guys
  44. //=--------------------------------------------------------------------------=
  45. //
  46. //void * _cdecl operator new(size_t size);
  47. //void  _cdecl operator delete(void *ptr);
  48.  
  49.  
  50. //=--------------------------------------------------------------------------=
  51. // Useful macros
  52. //=--------------------------------------------------------------------------=
  53. //
  54. // handy error macros, randing from cleaning up, to returning to clearing
  55. // rich error information as well.
  56. //
  57. #define RETURN_ON_FAILURE(hr) if (FAILED(hr)) return hr
  58. #define RETURN_ON_NULLALLOC(ptr) if (!(ptr)) return E_OUTOFMEMORY
  59. #define CLEANUP_ON_FAILURE(hr) if (FAILED(hr)) goto CleanUp
  60. #define CLEARERRORINFORET(hr) { SetErrorInfo(0, NULL); return hr; }
  61. #define CLEARERRORINFORET_ON_FAILURE(hr) if (FAILED(hr)) { SetErrorInfo(0, NULL); return hr; }
  62.  
  63. #define CLEANUP_ON_ERROR(l)    if (l != ERROR_SUCCESS) goto CleanUp
  64.  
  65. // conversions
  66. //
  67. #define BOOL_TO_VARIANTBOOL(f) (f) ? VARIANT_TRUE : VARIANT_FALSE
  68.  
  69. // Reference counting help.
  70. //
  71. #define RELEASE_OBJECT(ptr)    if (ptr) { IUnknown *pUnk = (ptr); (ptr) = NULL; pUnk->Release(); }
  72. #define QUICK_RELEASE(ptr)     if (ptr) ((IUnknown *)ptr)->Release();
  73. #define ADDREF_OBJECT(ptr)     if (ptr) (ptr)->AddRef()
  74.  
  75.  
  76.  
  77. //=--------------------------------------------------------------------------=
  78. // QueryInterface Optimizations
  79. //=--------------------------------------------------------------------------=
  80. // for optimizing QI's
  81. //
  82. #define DO_GUIDS_MATCH(riid1, riid2) ((riid1.Data1 == riid2.Data1) && (riid1 == riid2))
  83.  
  84. // Data1_*
  85. //
  86. // the first dword of GUIDs for most of the interesting interfaces.  these are
  87. // used by speed critical versions of QueryInterface
  88. //
  89. #define Data1_IAdviseSink                  0x0000010f
  90. #define Data1_IAdviseSink2                 0x00000125
  91. #define Data1_IAdviseSinkEx                0x3af24290
  92. #define Data1_IBindCtx                     0x0000000e
  93. #define Data1_ICDataDoc                    0xF413E4C0
  94. #define Data1_IClassFactory                0x00000001
  95. #define Data1_IClassFactory2               0xb196b28f
  96. #define Data1_IConnectionPoint             0xb196b286
  97. #define Data1_IConnectionPointContainer    0xb196b284
  98. #define Data1_IControl_95                  0x9a4bbfb5
  99. #define Data1_IControl                     0xa7fddba0
  100. #define Data1_ICreateErrorInfo             0x22f03340
  101. #define Data1_ICreateTypeInfo              0x00020405
  102. #define Data1_ICreateTypeLib               0x00020406
  103. #define Data1_IDataAdviseHolder            0x00000110
  104. #define Data1_IDataFrame                   0x97F254E0
  105. #define Data1_IDataFrameExpert             0x73687490
  106. #define Data1_IDataObject                  0x0000010e
  107. #define Data1_IDispatch                    0x00020400
  108. #define Data1_IDropSource                  0x00000121
  109. #define Data1_IDropTarget                  0x00000122
  110. #define Data1_IEnumCallback                0x00000108
  111. #define Data1_IEnumConnectionPoints        0xb196b285
  112. #define Data1_IEnumConnections             0xb196b287
  113. #define Data1_IEnumFORMATETC               0x00000103
  114. #define Data1_IEnumGeneric                 0x00000106
  115. #define Data1_IEnumHolder                  0x00000107
  116. #define Data1_IEnumMoniker                 0x00000102
  117. #define Data1_IEnumOLEVERB                 0x00000104
  118. #define Data1_IEnumSTATDATA                0x00000105
  119. #define Data1_IEnumSTATSTG                 0x0000000d
  120. #define Data1_IEnumString                  0x00000101
  121. #define Data1_IEnumOleUndoActions          0xb3e7c340
  122. #define Data1_IEnumUnknown                 0x00000100
  123. #define Data1_IEnumVARIANT                 0x00020404
  124. #define Data1_IErrorInfo                   0x1cf2b120
  125. #define Data1_IExternalConnection          0x00000019
  126. #define Data1_IFont                        0xbef6e002
  127. #define Data1_IFontDisp                    0xbef6e003
  128. #define Data1_IFormExpert                  0x5aac7f70
  129. #define Data1_IGangConnectWithDefault      0x6d5140c0
  130. #define Data1_IInternalMoniker             0x00000011
  131. #define Data1_ILockBytes                   0x0000000a
  132. #define Data1_IMalloc                      0x00000002
  133. #define Data1_IMarshal                     0x00000003
  134. #define Data1_IMessageFilter               0x00000016
  135. #define Data1_IMoniker                     0x0000000f
  136. #define Data1_IMsoCommandTarget            0xb722bccb
  137. #define Data1_IMsoDocument                 0xb722bcc5
  138. #define Data1_IOleInPlaceComponent         0x5efc7970
  139. #define Data1_IMsoView                     0xb722bcc6
  140. #define Data1_IOleAdviseHolder             0x00000111
  141. #define Data1_IOleCache                    0x0000011e
  142. #define Data1_IOleCache2                   0x00000128
  143. #define Data1_IOleCacheControl             0x00000129
  144. #define Data1_IOleClientSite               0x00000118
  145. #define Data1_IOleCompoundUndoAction       0xa1faf330
  146. #define Data1_IOleContainer                0x0000011b
  147. #define Data1_IOleControl                  0xb196b288
  148. #define Data1_IOleControlSite              0xb196b289
  149. #define Data1_IOleInPlaceActiveObject      0x00000117
  150. #define Data1_IOleInPlaceFrame             0x00000116
  151. #define Data1_IOleInPlaceObject            0x00000113
  152. #define Data1_IOleInPlaceObjectWindowless  0x1c2056cc
  153. #define Data1_IOleInPlaceSite              0x00000119
  154. #define Data1_IOleInPlaceSiteEx            0x9c2cad80
  155. #define Data1_IOleInPlaceSiteWindowless    0x922eada0
  156. #define Data1_IOleInPlaceUIWindow          0x00000115
  157. #define Data1_IOleItemContainer            0x0000011c
  158. #define Data1_IOleLink                     0x0000011d
  159. #define Data1_IOleManager                  0x0000011f
  160. #define Data1_IOleObject                   0x00000112
  161. #define Data1_IOlePresObj                  0x00000120
  162. #define Data1_IOlePropertyFrame            0xb83bb801
  163. #define Data1_IOleStandardTool             0xd97877c4
  164. #define Data1_IOleUndoAction               0x894ad3b0
  165. #define Data1_IOleUndoActionManager        0xd001f200
  166. #define Data1_IOleWindow                   0x00000114
  167. #define Data1_IPSFactory                   0x00000009
  168. #define Data1_IPSFactoryBuffer             0xd5f569d0
  169. #define Data1_IParseDisplayName            0x0000011a
  170. #define Data1_IPerPropertyBrowsing         0x376bd3aa
  171. #define Data1_IPersist                     0x0000010c
  172. #define Data1_IPersistFile                 0x0000010b
  173. #define Data1_IPersistPropertyBag          0x37D84F60
  174. #define Data1_IPersistStorage              0x0000010a
  175. #define Data1_IPersistStream               0x00000109
  176. #define Data1_IPersistStreamInit           0x7fd52380
  177. #define Data1_IPicture                     0x7bf80980
  178. #define Data1_IPictureDisp                 0x7bf80981
  179. #define Data1_IPointerInactive             0x55980ba0
  180. #define Data1_IPropertyNotifySink          0x9bfbbc02
  181. #define Data1_IPropertyPage                0xb196b28d
  182. #define Data1_IPropertyPage2               0x01e44665
  183. #define Data1_IPropertyPage3               0xb83bb803
  184. #define Data1_IPropertyPageInPlace         0xb83bb802
  185. #define Data1_IPropertyPageSite            0xb196b28c
  186. #define Data1_IPropertyPageSite2           0xb83bb804
  187. #define Data1_IProvideClassInfo            0xb196b283
  188. #define Data1_IProvideDynamicClassInfo     0x6d5140d1
  189. #define Data1_IQuickActivate               0xcf51ed10
  190. #define Data1_IRequireClasses              0x6d5140d0
  191. #define Data1_IRootStorage                 0x00000012
  192. #define Data1_IRunnableObject              0x00000126
  193. #define Data1_IRunningObjectTable          0x00000010
  194. #define Data1_ISelectionContainer          0x6d5140c6
  195. #define Data1_IServiceProvider             0x6d5140c1
  196. #define Data1_ISimpleFrameSite             0x742b0e01
  197. #define Data1_ISpecifyPropertyPages        0xb196b28b
  198. #define Data1_IStdMarshalInfo              0x00000018
  199. #define Data1_IStorage                     0x0000000b
  200. #define Data1_IStream                      0x0000000c
  201. #define Data1_ISupportErrorInfo            0xdf0b3d60
  202. #define Data1_ITypeComp                    0x00020403
  203. #define Data1_ITypeInfo                    0x00020401
  204. #define Data1_ITypeLib                     0x00020402
  205. #define Data1_IUnknown                     0x00000000
  206. #define Data1_IViewObject                  0x0000010d
  207. #define Data1_IViewObject2                 0x00000127
  208. #define Data1_IViewObjectEx                0x3af24292
  209. #define Data1_IWeakRef                     0x0000001a
  210. #define Data1_ICategorizeProperties        0x4d07fc10
  211.  
  212.  
  213. #define QI_INHERITS(pObj, itf)              \
  214.     case Data1_##itf:                       \
  215.       if(DO_GUIDS_MATCH(riid, IID_##itf))    \
  216.       {                                     \
  217.         *ppvObjOut = (void *)(itf *)pObj;   \
  218.       }                                     \
  219.       break;
  220.  
  221. #include "extobj.h"
  222.  
  223.  
  224. #define _IPSERVER_H_
  225. #endif // _IPSERVER_H_
  226.