Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

428 lines
15 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // File: OLE2.h
  7. // Contents: Main OLE2 header; Defines Linking and Emmebbeding interfaces, and API's.
  8. // Also includes .h files for the compobj, and oleauto subcomponents.
  9. //
  10. //----------------------------------------------------------------------------
  11. #if !defined( _OLE2_H_ )
  12. #define _OLE2_H_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. #ifndef _MAC
  17. // Set packing to 8
  18. #include <pshpack8.h>
  19. // Make 100% sure WIN32 is defined
  20. #ifndef WIN32
  21. #define WIN32 100 // 100 == NT version 1.0
  22. #endif
  23. #else //_MAC
  24. #ifdef _WIN32
  25. #include "macname1.h"
  26. #endif // _WIN32
  27. #endif //_MAC
  28. // SET to remove _export from interface definitions
  29. #include <winerror.h>
  30. #ifdef _MAC
  31. #if !defined(__MACPUB__)
  32. #include <macpub.h>
  33. #endif
  34. #endif //_MAC
  35. #include <objbase.h>
  36. #include <oleauto.h>
  37. // View OBJECT Error Codes
  38. #define E_DRAW VIEW_E_DRAW
  39. // IDataObject Error Codes
  40. #define DATA_E_FORMATETC DV_E_FORMATETC
  41. #ifdef _MAC
  42. /****** Standard Object Definitions *****************************************/
  43. //#ifndef __COMPOBJ__
  44. //#include <compobj.h>
  45. //#endif
  46. typedef enum {
  47. OLE_E_NOEXTENSION = OLE_E_NOSTORAGE +1, // no extension at startup
  48. OLE_E_VERSEXTENSION, // extension has wrong version #
  49. OLE_E_IPBUSY, // cannot get inplace resource
  50. OLE_E_NOT_FRONT_PROCESS, // inplace container unexpectedly in background
  51. OLE_E_WRONG_MENU, // holemenu != prev holemenu
  52. OLE_E_MENU_NOT_PATCHED, // menubar is not hashed
  53. OLE_E_MENUID_NOT_HASHED, // id was never hashed
  54. OLE_E_foo
  55. } inplace_errors;
  56. // DoDragDropMac()
  57. typedef struct tagDRAG_FLAVORINFO {
  58. unsigned long cfFormat;
  59. unsigned long FlavorFlags; // Flavor Flags as specified by the DragManager
  60. OLEBOOL fAddData; // If true, the data is added with the flavor
  61. long reserved; // must be NULL
  62. } DRAG_FLAVORINFO;
  63. #endif //_MAC
  64. // Common stuff gleamed from OLE.2,
  65. /* verbs */
  66. #define OLEIVERB_PRIMARY (0L)
  67. #define OLEIVERB_SHOW (-1L)
  68. #define OLEIVERB_OPEN (-2L)
  69. #define OLEIVERB_HIDE (-3L)
  70. #define OLEIVERB_UIACTIVATE (-4L)
  71. #define OLEIVERB_INPLACEACTIVATE (-5L)
  72. #define OLEIVERB_DISCARDUNDOSTATE (-6L)
  73. // for OleCreateEmbeddingHelper flags; roles in low word; options in high word
  74. #define EMBDHLP_INPROC_HANDLER 0x0000L
  75. #define EMBDHLP_INPROC_SERVER 0x0001L
  76. #define EMBDHLP_CREATENOW 0x00000000L
  77. #define EMBDHLP_DELAYCREATE 0x00010000L
  78. /* extended create function flags */
  79. #define OLECREATE_LEAVERUNNING 0x00000001
  80. /* pull in the MIDL generated header */
  81. #include <oleidl.h>
  82. #ifdef _MAC
  83. typedef struct tagOleMBarRec
  84. {
  85. long reserved;
  86. } OleMBarRec, *OleMBarPtr, **OleMBarHandle;
  87. #define noAxis 3 // indicates no grow or size in any direction
  88. // see mac #defines noConstraint, hAxisOnly, vAxisOnly
  89. #endif //_MAC
  90. /****** DV APIs ***********************************************************/
  91. WINOLEAPI CreateDataAdviseHolder(OUT LPDATAADVISEHOLDER FAR* ppDAHolder);
  92. /****** OLE API Prototypes ************************************************/
  93. WINOLEAPI_(DWORD) OleBuildVersion( VOID );
  94. /* helper functions */
  95. WINOLEAPI ReadClassStg(IN LPSTORAGE pStg, OUT CLSID FAR* pclsid);
  96. WINOLEAPI WriteClassStg(IN LPSTORAGE pStg, IN REFCLSID rclsid);
  97. WINOLEAPI ReadClassStm(IN LPSTREAM pStm, OUT CLSID FAR* pclsid);
  98. WINOLEAPI WriteClassStm(IN LPSTREAM pStm, IN REFCLSID rclsid);
  99. WINOLEAPI WriteFmtUserTypeStg (IN LPSTORAGE pstg, IN CLIPFORMAT cf, IN LPOLESTR lpszUserType);
  100. WINOLEAPI ReadFmtUserTypeStg (IN LPSTORAGE pstg, OUT CLIPFORMAT FAR* pcf, OUT LPOLESTR FAR* lplpszUserType);
  101. /* init/term */
  102. WINOLEAPI OleInitialize(IN LPVOID pvReserved);
  103. WINOLEAPI_(void) OleUninitialize(void);
  104. /* APIs to query whether (Embedded/Linked) object can be created from
  105. the data object */
  106. WINOLEAPI OleQueryLinkFromData(IN LPDATAOBJECT pSrcDataObject);
  107. WINOLEAPI OleQueryCreateFromData(IN LPDATAOBJECT pSrcDataObject);
  108. /* Object creation APIs */
  109. WINOLEAPI OleCreate(IN REFCLSID rclsid, IN REFIID riid, IN DWORD renderopt,
  110. IN LPFORMATETC pFormatEtc, IN LPOLECLIENTSITE pClientSite,
  111. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  112. WINOLEAPI OleCreateEx(IN REFCLSID rclsid, IN REFIID riid, IN DWORD dwFlags,
  113. IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  114. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  115. OUT DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  116. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  117. WINOLEAPI OleCreateFromData(IN LPDATAOBJECT pSrcDataObj, IN REFIID riid,
  118. IN DWORD renderopt, IN LPFORMATETC pFormatEtc,
  119. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg,
  120. OUT LPVOID FAR* ppvObj);
  121. WINOLEAPI OleCreateFromDataEx(IN LPDATAOBJECT pSrcDataObj, IN REFIID riid,
  122. IN DWORD dwFlags, IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  123. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  124. OUT DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  125. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  126. WINOLEAPI OleCreateLinkFromData(IN LPDATAOBJECT pSrcDataObj, IN REFIID riid,
  127. IN DWORD renderopt, IN LPFORMATETC pFormatEtc,
  128. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg,
  129. OUT LPVOID FAR* ppvObj);
  130. WINOLEAPI OleCreateLinkFromDataEx(IN LPDATAOBJECT pSrcDataObj, IN REFIID riid,
  131. IN DWORD dwFlags, IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  132. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  133. OUT IN DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  134. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  135. WINOLEAPI OleCreateStaticFromData(IN LPDATAOBJECT pSrcDataObj, IN REFIID iid,
  136. IN DWORD renderopt, IN LPFORMATETC pFormatEtc,
  137. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg,
  138. OUT LPVOID FAR* ppvObj);
  139. WINOLEAPI OleCreateLink(IN LPMONIKER pmkLinkSrc, IN REFIID riid,
  140. IN DWORD renderopt, IN LPFORMATETC lpFormatEtc,
  141. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  142. WINOLEAPI OleCreateLinkEx(IN LPMONIKER pmkLinkSrc, IN REFIID riid,
  143. IN DWORD dwFlags, IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  144. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  145. OUT DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  146. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  147. WINOLEAPI OleCreateLinkToFile(IN LPCOLESTR lpszFileName, IN REFIID riid,
  148. IN DWORD renderopt, IN LPFORMATETC lpFormatEtc,
  149. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  150. WINOLEAPI OleCreateLinkToFileEx(IN LPCOLESTR lpszFileName, IN REFIID riid,
  151. IN DWORD dwFlags, IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  152. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  153. OUT DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  154. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  155. WINOLEAPI OleCreateFromFile(IN REFCLSID rclsid, IN LPCOLESTR lpszFileName, IN REFIID riid,
  156. IN DWORD renderopt, IN LPFORMATETC lpFormatEtc,
  157. IN LPOLECLIENTSITE pClientSite, IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  158. WINOLEAPI OleCreateFromFileEx(IN REFCLSID rclsid, IN LPCOLESTR lpszFileName, IN REFIID riid,
  159. IN DWORD dwFlags, IN DWORD renderopt, IN ULONG cFormats, IN DWORD* rgAdvf,
  160. IN LPFORMATETC rgFormatEtc, IN IAdviseSink FAR* lpAdviseSink,
  161. OUT DWORD FAR* rgdwConnection, IN LPOLECLIENTSITE pClientSite,
  162. IN LPSTORAGE pStg, OUT LPVOID FAR* ppvObj);
  163. WINOLEAPI OleLoad(IN LPSTORAGE pStg, IN REFIID riid, IN LPOLECLIENTSITE pClientSite,
  164. OUT LPVOID FAR* ppvObj);
  165. WINOLEAPI OleSave(IN LPPERSISTSTORAGE pPS, IN LPSTORAGE pStg, IN BOOL fSameAsLoad);
  166. WINOLEAPI OleLoadFromStream( IN LPSTREAM pStm, IN REFIID iidInterface, OUT LPVOID FAR* ppvObj);
  167. WINOLEAPI OleSaveToStream( IN LPPERSISTSTREAM pPStm, IN LPSTREAM pStm );
  168. WINOLEAPI OleSetContainedObject(IN LPUNKNOWN pUnknown, IN BOOL fContained);
  169. WINOLEAPI OleNoteObjectVisible(IN LPUNKNOWN pUnknown, IN BOOL fVisible);
  170. /* Drag/Drop APIs */
  171. WINOLEAPI RegisterDragDrop(IN HWND hwnd, IN LPDROPTARGET pDropTarget);
  172. WINOLEAPI RevokeDragDrop(IN HWND hwnd);
  173. WINOLEAPI DoDragDrop(IN LPDATAOBJECT pDataObj, IN LPDROPSOURCE pDropSource,
  174. IN DWORD dwOKEffects, OUT LPDWORD pdwEffect);
  175. /* Clipboard APIs */
  176. WINOLEAPI OleSetClipboard(IN LPDATAOBJECT pDataObj);
  177. WINOLEAPI OleGetClipboard(OUT LPDATAOBJECT FAR* ppDataObj);
  178. WINOLEAPI OleFlushClipboard(void);
  179. WINOLEAPI OleIsCurrentClipboard(IN LPDATAOBJECT pDataObj);
  180. /* InPlace Editing APIs */
  181. WINOLEAPI_(HOLEMENU) OleCreateMenuDescriptor (IN HMENU hmenuCombined,
  182. IN LPOLEMENUGROUPWIDTHS lpMenuWidths);
  183. WINOLEAPI OleSetMenuDescriptor (IN HOLEMENU holemenu, IN HWND hwndFrame,
  184. IN HWND hwndActiveObject,
  185. IN LPOLEINPLACEFRAME lpFrame,
  186. IN LPOLEINPLACEACTIVEOBJECT lpActiveObj);
  187. WINOLEAPI OleDestroyMenuDescriptor (IN HOLEMENU holemenu);
  188. WINOLEAPI OleTranslateAccelerator (IN LPOLEINPLACEFRAME lpFrame,
  189. IN LPOLEINPLACEFRAMEINFO lpFrameInfo, IN LPMSG lpmsg);
  190. /* Helper APIs */
  191. WINOLEAPI_(HANDLE) OleDuplicateData (IN HANDLE hSrc, IN CLIPFORMAT cfFormat,
  192. IN UINT uiFlags);
  193. WINOLEAPI OleDraw (IN LPUNKNOWN pUnknown, IN DWORD dwAspect, IN HDC hdcDraw,
  194. IN LPCRECT lprcBounds);
  195. WINOLEAPI OleRun(IN LPUNKNOWN pUnknown);
  196. WINOLEAPI_(BOOL) OleIsRunning(IN LPOLEOBJECT pObject);
  197. WINOLEAPI OleLockRunning(IN LPUNKNOWN pUnknown, IN BOOL fLock, IN BOOL fLastUnlockCloses);
  198. WINOLEAPI_(void) ReleaseStgMedium(IN LPSTGMEDIUM);
  199. WINOLEAPI CreateOleAdviseHolder(OUT LPOLEADVISEHOLDER FAR* ppOAHolder);
  200. WINOLEAPI OleCreateDefaultHandler(IN REFCLSID clsid, IN LPUNKNOWN pUnkOuter,
  201. IN REFIID riid, OUT LPVOID FAR* lplpObj);
  202. WINOLEAPI OleCreateEmbeddingHelper(IN REFCLSID clsid, IN LPUNKNOWN pUnkOuter,
  203. IN DWORD flags, IN LPCLASSFACTORY pCF,
  204. IN REFIID riid, OUT LPVOID FAR* lplpObj);
  205. WINOLEAPI_(BOOL) IsAccelerator(IN HACCEL hAccel, IN int cAccelEntries, IN LPMSG lpMsg,
  206. OUT WORD FAR* lpwCmd);
  207. /* Icon extraction Helper APIs */
  208. WINOLEAPI_(HGLOBAL) OleGetIconOfFile(IN LPOLESTR lpszPath, IN BOOL fUseFileAsLabel);
  209. WINOLEAPI_(HGLOBAL) OleGetIconOfClass(IN REFCLSID rclsid, IN LPOLESTR lpszLabel,
  210. IN BOOL fUseTypeAsLabel);
  211. WINOLEAPI_(HGLOBAL) OleMetafilePictFromIconAndLabel(IN HICON hIcon, IN LPOLESTR lpszLabel,
  212. IN LPOLESTR lpszSourceFile, IN UINT iIconIndex);
  213. /* Registration Database Helper APIs */
  214. WINOLEAPI OleRegGetUserType (IN REFCLSID clsid, IN DWORD dwFormOfType,
  215. OUT LPOLESTR FAR* pszUserType);
  216. WINOLEAPI OleRegGetMiscStatus (IN REFCLSID clsid, IN DWORD dwAspect,
  217. OUT DWORD FAR* pdwStatus);
  218. WINOLEAPI OleRegEnumFormatEtc (IN REFCLSID clsid, IN DWORD dwDirection,
  219. OUT LPENUMFORMATETC FAR* ppenum);
  220. WINOLEAPI OleRegEnumVerbs (IN REFCLSID clsid, OUT LPENUMOLEVERB FAR* ppenum);
  221. #ifdef _MAC
  222. /* WlmOLE helper APIs */
  223. WINOLEAPI WlmOleCheckoutMacInterface(LPUNKNOWN pUnk, LPVOID* ppv);
  224. WINOLEAPI WlmOleCheckinMacInterface(LPUNKNOWN pUnk);
  225. WINOLEAPI WlmOleWrapMacInterface(LPUNKNOWN pUnk, REFIID riid, LPVOID* ppv);
  226. WINOLEAPI WlmOleUnwrapMacInterface(LPVOID pv);
  227. WINOLEAPI WlmOleCheckoutWinInterface(LPVOID pUnk, LPUNKNOWN* ppv);
  228. WINOLEAPI WlmOleCheckinWinInterface(LPVOID pUnk);
  229. WINOLEAPI WlmOleWrapWinInterface(LPVOID pUnk, REFIID riid, LPUNKNOWN* ppv);
  230. WINOLEAPI WlmOleUnwrapWinInterface(LPVOID pv);
  231. WINOLEAPI_(void) WlmOleVersion(void);
  232. WINOLEAPI_(void) WlmOleSetInPlaceWindow(HWND hwnd);
  233. typedef HRESULT (STDAPICALLTYPE* OLEWRAPPROC) (REFIID riid, LPVOID* ppvWin, LPVOID* ppvMac);
  234. WINOLEAPI WlmOleRegisterUserWrap(OLEWRAPPROC procNew, OLEWRAPPROC* pprocOld);
  235. #endif
  236. /* OLE 1.0 conversion APIS */
  237. /***** OLE 1.0 OLESTREAM declarations *************************************/
  238. typedef struct _OLESTREAM FAR* LPOLESTREAM;
  239. typedef struct _OLESTREAMVTBL
  240. {
  241. DWORD (CALLBACK* Get)(LPOLESTREAM, void FAR*, DWORD);
  242. DWORD (CALLBACK* Put)(LPOLESTREAM, const void FAR*, DWORD);
  243. } OLESTREAMVTBL;
  244. typedef OLESTREAMVTBL FAR* LPOLESTREAMVTBL;
  245. typedef struct _OLESTREAM
  246. {
  247. LPOLESTREAMVTBL lpstbl;
  248. } OLESTREAM;
  249. WINOLEAPI OleConvertOLESTREAMToIStorage
  250. (IN LPOLESTREAM lpolestream,
  251. OUT LPSTORAGE pstg,
  252. IN const DVTARGETDEVICE FAR* ptd);
  253. WINOLEAPI OleConvertIStorageToOLESTREAM
  254. (IN LPSTORAGE pstg,
  255. OUT LPOLESTREAM lpolestream);
  256. /* Storage Utility APIs */
  257. WINOLEAPI GetHGlobalFromILockBytes (IN LPLOCKBYTES plkbyt, OUT HGLOBAL FAR* phglobal);
  258. WINOLEAPI CreateILockBytesOnHGlobal (IN HGLOBAL hGlobal, IN BOOL fDeleteOnRelease,
  259. OUT LPLOCKBYTES FAR* pplkbyt);
  260. WINOLEAPI GetHGlobalFromStream (IN LPSTREAM pstm, OUT HGLOBAL FAR* phglobal);
  261. WINOLEAPI CreateStreamOnHGlobal (IN HGLOBAL hGlobal, IN BOOL fDeleteOnRelease,
  262. OUT LPSTREAM FAR* ppstm);
  263. /* ConvertTo APIS */
  264. WINOLEAPI OleDoAutoConvert(IN LPSTORAGE pStg, OUT LPCLSID pClsidNew);
  265. WINOLEAPI OleGetAutoConvert(IN REFCLSID clsidOld, OUT LPCLSID pClsidNew);
  266. WINOLEAPI OleSetAutoConvert(IN REFCLSID clsidOld, IN REFCLSID clsidNew);
  267. WINOLEAPI GetConvertStg(IN LPSTORAGE pStg);
  268. WINOLEAPI SetConvertStg(IN LPSTORAGE pStg, IN BOOL fConvert);
  269. WINOLEAPI OleConvertIStorageToOLESTREAMEx
  270. (IN LPSTORAGE pstg,
  271. // Presentation data to OLESTREAM
  272. IN CLIPFORMAT cfFormat, // format
  273. IN LONG lWidth, // width
  274. IN LONG lHeight, // height
  275. IN DWORD dwSize, // size in bytes
  276. IN LPSTGMEDIUM pmedium, // bits
  277. OUT LPOLESTREAM polestm);
  278. WINOLEAPI OleConvertOLESTREAMToIStorageEx
  279. (IN LPOLESTREAM polestm,
  280. OUT LPSTORAGE pstg,
  281. // Presentation data from OLESTREAM
  282. OUT CLIPFORMAT FAR* pcfFormat, // format
  283. OUT LONG FAR* plwWidth, // width
  284. OUT LONG FAR* plHeight, // height
  285. OUT DWORD FAR* pdwSize, // size in bytes
  286. OUT LPSTGMEDIUM pmedium); // bits
  287. #ifndef _MAC
  288. #ifndef RC_INVOKED
  289. #include <poppack.h>
  290. #endif // RC_INVOKED
  291. #else // _MAC
  292. #ifndef __MACAPI__
  293. #include <macapi.h>
  294. #endif
  295. #ifdef _WIN32
  296. #include "macname2.h"
  297. #endif // _WIN32
  298. #endif // _MAC
  299. #endif // __OLE2_H__