OLE2.H
上传用户:zdlsnail
上传日期:2007-01-06
资源大小:16k
文件大小:10k
源码类别:

压缩解压

开发平台:

Visual C++

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1992 - 1995.
  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. // Set packing to 8
  14. #include <pshpack8.h>
  15. // Make 100% sure WIN32 is defined
  16. #ifndef WIN32
  17. #define WIN32    100  // 100 == NT version 1.0
  18. #endif
  19. // SET to remove _export from interface definitions
  20. #ifndef  _WINERROR_
  21. #include <winerror.h>
  22. #endif
  23. #include <objbase.h>
  24. #include <oleauto.h>
  25. // View OBJECT Error Codes
  26. #define E_DRAW                  VIEW_E_DRAW
  27. // IDataObject Error Codes
  28. #define DATA_E_FORMATETC        DV_E_FORMATETC
  29. // Common stuff gleamed from OLE.2,
  30. /* verbs */
  31. #define OLEIVERB_PRIMARY            (0L)
  32. #define OLEIVERB_SHOW               (-1L)
  33. #define OLEIVERB_OPEN               (-2L)
  34. #define OLEIVERB_HIDE               (-3L)
  35. #define OLEIVERB_UIACTIVATE         (-4L)
  36. #define OLEIVERB_INPLACEACTIVATE    (-5L)
  37. #define OLEIVERB_DISCARDUNDOSTATE   (-6L)
  38. // for OleCreateEmbeddingHelper flags; roles in low word; options in high word
  39. #define EMBDHLP_INPROC_HANDLER   0x0000L
  40. #define EMBDHLP_INPROC_SERVER    0x0001L
  41. #define EMBDHLP_CREATENOW    0x00000000L
  42. #define EMBDHLP_DELAYCREATE  0x00010000L
  43. /* pull in the MIDL generated header */
  44. #include <oleidl.h>
  45. /****** DV APIs ***********************************************************/
  46. WINOLEAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER FAR* ppDAHolder);
  47. /****** OLE API Prototypes ************************************************/
  48. WINOLEAPI_(DWORD) OleBuildVersion( VOID );
  49. /* helper functions */
  50. WINOLEAPI ReadClassStg(LPSTORAGE pStg, CLSID FAR* pclsid);
  51. WINOLEAPI WriteClassStg(LPSTORAGE pStg, REFCLSID rclsid);
  52. WINOLEAPI ReadClassStm(LPSTREAM pStm, CLSID FAR* pclsid);
  53. WINOLEAPI WriteClassStm(LPSTREAM pStm, REFCLSID rclsid);
  54. WINOLEAPI WriteFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType);
  55. WINOLEAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT FAR* pcf, LPOLESTR FAR* lplpszUserType);
  56. /* init/term */
  57. WINOLEAPI OleInitialize(LPVOID pvReserved);
  58. WINOLEAPI_(void) OleUninitialize(void);
  59. /* APIs to query whether (Embedded/Linked) object can be created from
  60.    the data object */
  61. WINOLEAPI  OleQueryLinkFromData(LPDATAOBJECT pSrcDataObject);
  62. WINOLEAPI  OleQueryCreateFromData(LPDATAOBJECT pSrcDataObject);
  63. /* Object creation APIs */
  64. WINOLEAPI  OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt,
  65.                 LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite,
  66.                 LPSTORAGE pStg, LPVOID FAR* ppvObj);
  67. WINOLEAPI  OleCreateFromData(LPDATAOBJECT pSrcDataObj, REFIID riid,
  68.                 DWORD renderopt, LPFORMATETC pFormatEtc,
  69.                 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,
  70.                 LPVOID FAR* ppvObj);
  71. WINOLEAPI  OleCreateLinkFromData(LPDATAOBJECT pSrcDataObj, REFIID riid,
  72.                 DWORD renderopt, LPFORMATETC pFormatEtc,
  73.                 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,
  74.                 LPVOID FAR* ppvObj);
  75. WINOLEAPI  OleCreateStaticFromData(LPDATAOBJECT pSrcDataObj, REFIID iid,
  76.                 DWORD renderopt, LPFORMATETC pFormatEtc,
  77.                 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,
  78.                 LPVOID FAR* ppvObj);
  79. WINOLEAPI  OleCreateLink(LPMONIKER pmkLinkSrc, REFIID riid,
  80.             DWORD renderopt, LPFORMATETC lpFormatEtc,
  81.             LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID FAR* ppvObj);
  82. WINOLEAPI  OleCreateLinkToFile(LPCOLESTR lpszFileName, REFIID riid,
  83.             DWORD renderopt, LPFORMATETC lpFormatEtc,
  84.             LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID FAR* ppvObj);
  85. WINOLEAPI  OleCreateFromFile(REFCLSID rclsid, LPCOLESTR lpszFileName, REFIID riid,
  86.             DWORD renderopt, LPFORMATETC lpFormatEtc,
  87.             LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID FAR* ppvObj);
  88. WINOLEAPI  OleLoad(LPSTORAGE pStg, REFIID riid, LPOLECLIENTSITE pClientSite,
  89.             LPVOID FAR* ppvObj);
  90. WINOLEAPI  OleSave(LPPERSISTSTORAGE pPS, LPSTORAGE pStg, BOOL fSameAsLoad);
  91. WINOLEAPI  OleLoadFromStream( LPSTREAM pStm, REFIID iidInterface, LPVOID FAR* ppvObj);
  92. WINOLEAPI  OleSaveToStream( LPPERSISTSTREAM pPStm, LPSTREAM pStm );
  93. WINOLEAPI  OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained);
  94. WINOLEAPI  OleNoteObjectVisible(LPUNKNOWN pUnknown, BOOL fVisible);
  95. /* Drag/Drop APIs */
  96. WINOLEAPI  RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget);
  97. WINOLEAPI  RevokeDragDrop(HWND hwnd);
  98. WINOLEAPI  DoDragDrop(LPDATAOBJECT pDataObj, LPDROPSOURCE pDropSource,
  99.             DWORD dwOKEffects, LPDWORD pdwEffect);
  100. /* Clipboard APIs */
  101. WINOLEAPI  OleSetClipboard(LPDATAOBJECT pDataObj);
  102. WINOLEAPI  OleGetClipboard(LPDATAOBJECT FAR* ppDataObj);
  103. WINOLEAPI  OleFlushClipboard(void);
  104. WINOLEAPI  OleIsCurrentClipboard(LPDATAOBJECT pDataObj);
  105. /* InPlace Editing APIs */
  106. WINOLEAPI_(HOLEMENU)   OleCreateMenuDescriptor (HMENU hmenuCombined,
  107.                                 LPOLEMENUGROUPWIDTHS lpMenuWidths);
  108. WINOLEAPI              OleSetMenuDescriptor (HOLEMENU holemenu, HWND hwndFrame,
  109.                                 HWND hwndActiveObject,
  110.                                 LPOLEINPLACEFRAME lpFrame,
  111.                                 LPOLEINPLACEACTIVEOBJECT lpActiveObj);
  112. WINOLEAPI              OleDestroyMenuDescriptor (HOLEMENU holemenu);
  113. WINOLEAPI              OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame,
  114.                             LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg);
  115. /* Helper APIs */
  116. WINOLEAPI_(HANDLE) OleDuplicateData (HANDLE hSrc, CLIPFORMAT cfFormat,
  117.                         UINT uiFlags);
  118. WINOLEAPI          OleDraw (LPUNKNOWN pUnknown, DWORD dwAspect, HDC hdcDraw,
  119.                     LPCRECT lprcBounds);
  120. WINOLEAPI          OleRun(LPUNKNOWN pUnknown);
  121. WINOLEAPI_(BOOL)   OleIsRunning(LPOLEOBJECT pObject);
  122. WINOLEAPI          OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses);
  123. WINOLEAPI_(void)   ReleaseStgMedium(LPSTGMEDIUM);
  124. WINOLEAPI          CreateOleAdviseHolder(LPOLEADVISEHOLDER FAR* ppOAHolder);
  125. WINOLEAPI          OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter,
  126.                     REFIID riid, LPVOID FAR* lplpObj);
  127. WINOLEAPI          OleCreateEmbeddingHelper(REFCLSID clsid, LPUNKNOWN pUnkOuter,
  128.                     DWORD flags, LPCLASSFACTORY pCF,
  129.                                         REFIID riid, LPVOID FAR* lplpObj);
  130. WINOLEAPI_(BOOL)   IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg,
  131.                                         WORD FAR* lpwCmd);
  132. /* Icon extraction Helper APIs */
  133. WINOLEAPI_(HGLOBAL) OleGetIconOfFile(LPOLESTR lpszPath, BOOL fUseFileAsLabel);
  134. WINOLEAPI_(HGLOBAL) OleGetIconOfClass(REFCLSID rclsid,     LPOLESTR lpszLabel,
  135.                                         BOOL fUseTypeAsLabel);
  136. WINOLEAPI_(HGLOBAL) OleMetafilePictFromIconAndLabel(HICON hIcon, LPOLESTR lpszLabel,
  137.                                         LPOLESTR lpszSourceFile, UINT iIconIndex);
  138. /* Registration Database Helper APIs */
  139. WINOLEAPI                  OleRegGetUserType (REFCLSID clsid, DWORD dwFormOfType,
  140.                                         LPOLESTR FAR* pszUserType);
  141. WINOLEAPI                  OleRegGetMiscStatus     (REFCLSID clsid, DWORD dwAspect,
  142.                                         DWORD FAR* pdwStatus);
  143. WINOLEAPI                  OleRegEnumFormatEtc     (REFCLSID clsid, DWORD dwDirection,
  144.                                         LPENUMFORMATETC FAR* ppenum);
  145. WINOLEAPI                  OleRegEnumVerbs (REFCLSID clsid, LPENUMOLEVERB FAR* ppenum);
  146. /* OLE 1.0 conversion APIS */
  147. /***** OLE 1.0 OLESTREAM declarations *************************************/
  148. typedef struct _OLESTREAM FAR*  LPOLESTREAM;
  149. typedef struct _OLESTREAMVTBL
  150. {
  151.     DWORD (CALLBACK* Get)(LPOLESTREAM, void FAR*, DWORD);
  152.     DWORD (CALLBACK* Put)(LPOLESTREAM, const void FAR*, DWORD);
  153. } OLESTREAMVTBL;
  154. typedef  OLESTREAMVTBL FAR*  LPOLESTREAMVTBL;
  155. typedef struct _OLESTREAM
  156. {
  157.     LPOLESTREAMVTBL lpstbl;
  158. } OLESTREAM;
  159. WINOLEAPI OleConvertOLESTREAMToIStorage
  160.     (LPOLESTREAM                lpolestream,
  161.     LPSTORAGE                   pstg,
  162.     const DVTARGETDEVICE FAR*   ptd);
  163. WINOLEAPI OleConvertIStorageToOLESTREAM
  164.     (LPSTORAGE      pstg,
  165.     LPOLESTREAM     lpolestream);
  166. /* Storage Utility APIs */
  167. WINOLEAPI GetHGlobalFromILockBytes (LPLOCKBYTES plkbyt, HGLOBAL FAR* phglobal);
  168. WINOLEAPI CreateILockBytesOnHGlobal (HGLOBAL hGlobal, BOOL fDeleteOnRelease,
  169.                                     LPLOCKBYTES FAR* pplkbyt);
  170. WINOLEAPI GetHGlobalFromStream (LPSTREAM pstm, HGLOBAL FAR* phglobal);
  171. WINOLEAPI CreateStreamOnHGlobal (HGLOBAL hGlobal, BOOL fDeleteOnRelease,
  172.                                 LPSTREAM FAR* ppstm);
  173. /* ConvertTo APIS */
  174. WINOLEAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew);
  175. WINOLEAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew);
  176. WINOLEAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew);
  177. WINOLEAPI GetConvertStg(LPSTORAGE pStg);
  178. WINOLEAPI SetConvertStg(LPSTORAGE pStg, BOOL fConvert);
  179. WINOLEAPI OleConvertIStorageToOLESTREAMEx
  180.     (LPSTORAGE          pstg,
  181.                                     // Presentation data to OLESTREAM
  182.      CLIPFORMAT         cfFormat,   //      format
  183.      LONG               lWidth,     //      width
  184.      LONG               lHeight,    //      height
  185.      DWORD              dwSize,     //      size in bytes
  186.      LPSTGMEDIUM        pmedium,    //      bits
  187.      LPOLESTREAM        polestm);
  188. WINOLEAPI OleConvertOLESTREAMToIStorageEx
  189.     (LPOLESTREAM        polestm,
  190.      LPSTORAGE          pstg,
  191.                                     // Presentation data from OLESTREAM
  192.      CLIPFORMAT FAR*    pcfFormat,  //      format
  193.      LONG FAR*          plwWidth,   //      width
  194.      LONG FAR*          plHeight,   //      height
  195.      DWORD FAR*         pdwSize,    //      size in bytes
  196.      LPSTGMEDIUM        pmedium);   //      bits
  197. #ifndef RC_INVOKED
  198. #include <poppack.h>
  199. #endif // RC_INVOKED
  200. #endif     // __OLE2_H__