jwaactivex.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. {******************************************************************************}
  2. { }
  3. { Windows API interface Unit for Object Pascal }
  4. { Master file for Windows applications }
  5. { }
  6. { Portions created by Microsoft are Copyright (C) Microsoft Corporation. }
  7. { All Rights Reserved. }
  8. { }
  9. { The original Pascal code is: JwaActiveX.pas, released September 2005. }
  10. { The initial developer of the Pascal code is }
  11. { Robert Marquardt (robert_marquardt att gmx dott de). }
  12. { }
  13. { Portions created by Robert Marquardt are Copyright (C) 2005 }
  14. { Robert Marquardt. All Rights Reserved. }
  15. { }
  16. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  17. { }
  18. { You may retrieve the latest version of this file at the Project JEDI }
  19. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  20. { }
  21. { The contents of this file are used with permission, subject to the Mozilla }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html }
  25. { }
  26. { Software distributed under the License is distributed on an "AS IS" basis, }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License. }
  29. { }
  30. { Alternatively, the contents of this file may be used under the terms of the }
  31. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  32. { provisions of the LGPL License are applicable instead of those above. }
  33. { If you wish to allow use of your version of this file only under the terms }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting the provisions above and }
  36. { replace them with the notice and other provisions required by the LGPL }
  37. { License. If you do not delete the provisions above, a recipient may use }
  38. { your version of this file under either the MPL or the LGPL License. }
  39. { }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. { }
  42. {******************************************************************************}
  43. // $Id: JwaActiveX.pas,v 1.1 2005/09/03 13:12:10 marquardt Exp $
  44. unit JwaActiveX;
  45. {$WEAKPACKAGEUNIT}
  46. {$I jediapilib.inc}
  47. interface
  48. uses
  49. JwaWindows;
  50. const
  51. { IConnectionPoint status codes }
  52. CONNECT_E_FIRST = HRESULT($80040200);
  53. {$EXTERNALSYM CONNECT_E_FIRST}
  54. CONNECT_E_LAST = HRESULT($8004020F);
  55. {$EXTERNALSYM CONNECT_E_LAST}
  56. CONNECT_S_FIRST = $00040200;
  57. {$EXTERNALSYM CONNECT_S_FIRST}
  58. CONNECT_S_LAST = $0004020F;
  59. {$EXTERNALSYM CONNECT_S_LAST}
  60. CONNECT_E_NOCONNECTION = CONNECT_E_FIRST + 0;
  61. {$EXTERNALSYM CONNECT_E_NOCONNECTION}
  62. CONNECT_E_ADVISELIMIT = CONNECT_E_FIRST + 1;
  63. {$EXTERNALSYM CONNECT_E_ADVISELIMIT}
  64. CONNECT_E_CANNOTCONNECT = CONNECT_E_FIRST + 2;
  65. {$EXTERNALSYM CONNECT_E_CANNOTCONNECT}
  66. CONNECT_E_OVERRIDDEN = CONNECT_E_FIRST + 3;
  67. {$EXTERNALSYM CONNECT_E_OVERRIDDEN}
  68. type
  69. IStream = interface;
  70. IMoniker = interface;
  71. IEnumMoniker = interface;
  72. IConnectionPointContainer = interface;
  73. IEnumSTATPROPSTG = interface;
  74. IEnumSTATPROPSETSTG = interface;
  75. TOleChar = WideChar;
  76. POleStr = PWideChar;
  77. PPOleStr = ^POleStr;
  78. PIID = PGUID;
  79. TIID = TGUID;
  80. PCLSID = PGUID;
  81. TCLSID = TGUID;
  82. Largeint = Int64;
  83. {$EXTERNALSYM Largeint}
  84. TClipFormat = Word;
  85. {$EXTERNALSYM TClipFormat}
  86. PClipFormat = ^TClipFormat;
  87. {$EXTERNALSYM PClipFormat}
  88. POleBool = ^TOleBool;
  89. TOleBool = WordBool;
  90. {$EXTERNALSYM TOleBool}
  91. POleDate = ^TOleDate;
  92. TOleDate = Double;
  93. {$EXTERNALSYM TOleDate}
  94. PBStr = ^TBStr;
  95. TBStr = POleStr;
  96. PSCODE = ^SCODE;
  97. {$EXTERNALSYM PSCODE}
  98. SCODE = Integer;
  99. {$EXTERNALSYM SCODE}
  100. PPropID = ^PROPID;
  101. PROPID = ULONG;
  102. {$EXTERNALSYM PROPID}
  103. TPropID = PROPID;
  104. PFmtID = ^FMTID;
  105. FMTID = TGUID;
  106. {$EXTERNALSYM FMTID}
  107. TFmtID = FMTID;
  108. PSafeArrayBound = ^SAFEARRAYBOUND;
  109. SAFEARRAYBOUND = record
  110. cElements: Longint;
  111. lLbound: Longint;
  112. end;
  113. TSafeArrayBound = SAFEARRAYBOUND;
  114. {$EXTERNALSYM SAFEARRAYBOUND}
  115. PSafeArray = ^SAFEARRAY;
  116. SAFEARRAY = record
  117. cDims: Word;
  118. fFeatures: Word;
  119. cbElements: Longint;
  120. cLocks: Longint;
  121. pvData: Pointer;
  122. rgsabound: array [0..0] of TSafeArrayBound;
  123. end;
  124. TSafeArray = SAFEARRAY;
  125. {$EXTERNALSYM SAFEARRAY}
  126. (* tagBLOB related types cause problem due to two definitions of BLOB in wtypes.h/nspapi.h *)
  127. (* Investigating something that will always work even when a BLOB is not a tagBLOB *)
  128. {$EXTERNALSYM PBlob}
  129. PBlob = ^TBlob;
  130. {$EXTERNALSYM tagBLOB}
  131. tagBLOB = record
  132. cbSize: Longint;
  133. pBlobData: Pointer;
  134. end;
  135. (* tagBLOB related types cause problem due to two definitions of BLOB in wtypes.h/nspapi.h *)
  136. (* Investigating something that will always work even when a BLOB is not a tagBLOB *)
  137. {$EXTERNALSYM TBlob}
  138. TBlob = tagBLOB;
  139. {$EXTERNALSYM BLOB}
  140. BLOB = TBlob;
  141. PClipData = ^CLIPDATA;
  142. CLIPDATA = record
  143. cbSize: Longint;
  144. ulClipFmt: Longint;
  145. pClipData: Pointer;
  146. end;
  147. TClipData = CLIPDATA;
  148. {$EXTERNALSYM CLIPDATA}
  149. PDVTargetDevice = ^TDVTargetDevice;
  150. DVTARGETDEVICE = record
  151. tdSize: Longint;
  152. tdDriverNameOffset: Word;
  153. tdDeviceNameOffset: Word;
  154. tdPortNameOffset: Word;
  155. tdExtDevmodeOffset: Word;
  156. tdData: record end;
  157. end;
  158. {$EXTERNALSYM DVTARGETDEVICE}
  159. TDVTargetDevice = DVTARGETDEVICE;
  160. PFormatEtc = ^FORMATETC;
  161. FORMATETC = record
  162. cfFormat: TClipFormat;
  163. ptd: PDVTargetDevice;
  164. dwAspect: Longint;
  165. lindex: Longint;
  166. tymed: Longint;
  167. end;
  168. TFormatEtc = FORMATETC;
  169. {$EXTERNALSYM FORMATETC}
  170. PStgMedium = ^STGMEDIUM;
  171. STGMEDIUM = record
  172. tymed: Longint;
  173. case Integer of
  174. 0: (hBitmap: THandle; // HBITMAP
  175. unkForRelease: Pointer); // IUnknown
  176. 1: (hMetaFilePict: THandle);
  177. 2: (hEnhMetaFile: THandle);
  178. 3: (hGlobal: HGLOBAL);
  179. 4: (lpszFileName: POleStr);
  180. 5: (stm: Pointer); // IStream
  181. 6: (stg: Pointer); // IStorage
  182. end;
  183. TStgMedium = STGMEDIUM;
  184. {$EXTERNALSYM STGMEDIUM}
  185. IEnumVariant = interface(IUnknown)
  186. ['{00020404-0000-0000-C000-000000000046}']
  187. function Next(celt: Longword; var rgvar: OleVariant;
  188. out pceltFetched: Longword): HRESULT; stdcall;
  189. function Skip(celt: Longword): HRESULT; stdcall;
  190. function Reset: HRESULT; stdcall;
  191. function Clone(out Enum: IEnumVariant): HRESULT; stdcall;
  192. end;
  193. {$EXTERNALSYM IEnumVariant}
  194. IPersist = interface(IUnknown)
  195. ['{0000010C-0000-0000-C000-000000000046}']
  196. function GetClassID(out classID: TCLSID): HRESULT; stdcall;
  197. end;
  198. {$EXTERNALSYM IPersist}
  199. IEnumFORMATETC = interface(IUnknown)
  200. ['{00000103-0000-0000-C000-000000000046}']
  201. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  202. function Skip(celt: Longint): HRESULT; stdcall;
  203. function Reset: HRESULT; stdcall;
  204. function Clone(out Enum: IEnumFormatEtc): HRESULT; stdcall;
  205. end;
  206. {$EXTERNALSYM IEnumFORMATETC}
  207. IPersistStream = interface(IPersist)
  208. ['{00000109-0000-0000-C000-000000000046}']
  209. function IsDirty: HRESULT; stdcall;
  210. function Load(const stm: IStream): HRESULT; stdcall;
  211. function Save(const stm: IStream; fClearDirty: BOOL): HRESULT; stdcall;
  212. function GetSizeMax(out cbSize: Largeint): HRESULT; stdcall;
  213. end;
  214. {$EXTERNALSYM IPersistStream}
  215. PStatStg = ^TStatStg;
  216. STATSTG = record
  217. pwcsName: POleStr;
  218. dwType: Longint;
  219. cbSize: Largeint;
  220. mtime: TFileTime;
  221. ctime: TFileTime;
  222. atime: TFileTime;
  223. grfMode: Longint;
  224. grfLocksSupported: Longint;
  225. clsid: TCLSID;
  226. grfStateBits: Longint;
  227. reserved: Longint;
  228. end;
  229. TStatStg = STATSTG;
  230. {$EXTERNALSYM STATSTG}
  231. {$EXTERNALSYM ISequentialStream}
  232. ISequentialStream = interface(IUnknown)
  233. ['{0c733a30-2a1c-11ce-ade5-00aa0044773d}']
  234. function Read(pv: Pointer; cb: Longint; pcbRead: PLongint): HRESULT; stdcall;
  235. function Write(pv: Pointer; cb: Longint; pcbWritten: PLongint): HRESULT; stdcall;
  236. end;
  237. IStream = interface(ISequentialStream)
  238. ['{0000000C-0000-0000-C000-000000000046}']
  239. function Seek(dlibMove: Largeint; dwOrigin: Longint;
  240. out libNewPosition: Largeint): HRESULT; stdcall;
  241. function SetSize(libNewSize: Largeint): HRESULT; stdcall;
  242. function CopyTo(stm: IStream; cb: Largeint; out cbRead: Largeint;
  243. out cbWritten: Largeint): HRESULT; stdcall;
  244. function Commit(grfCommitFlags: Longint): HRESULT; stdcall;
  245. function Revert: HRESULT; stdcall;
  246. function LockRegion(libOffset: Largeint; cb: Largeint;
  247. dwLockType: Longint): HRESULT; stdcall;
  248. function UnlockRegion(libOffset: Largeint; cb: Largeint;
  249. dwLockType: Longint): HRESULT; stdcall;
  250. function Stat(out statstg: TStatStg; grfStatFlag: Longint): HRESULT; stdcall;
  251. function Clone(out stm: IStream): HRESULT; stdcall;
  252. end;
  253. {$EXTERNALSYM IStream}
  254. IEnumString = interface(IUnknown)
  255. ['{00000101-0000-0000-C000-000000000046}']
  256. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  257. function Skip(celt: Longint): HRESULT; stdcall;
  258. function Reset: HRESULT; stdcall;
  259. function Clone(out enm: IEnumString): HRESULT; stdcall;
  260. end;
  261. {$EXTERNALSYM IEnumString}
  262. IRunningObjectTable = interface(IUnknown)
  263. ['{00000010-0000-0000-C000-000000000046}']
  264. function Register(grfFlags: Longint; const unkObject: IUnknown;
  265. const mkObjectName: IMoniker; out dwRegister: Longint): HRESULT; stdcall;
  266. function Revoke(dwRegister: Longint): HRESULT; stdcall;
  267. function IsRunning(const mkObjectName: IMoniker): HRESULT; stdcall;
  268. function GetObject(const mkObjectName: IMoniker;
  269. out unkObject: IUnknown): HRESULT; stdcall;
  270. function NoteChangeTime(dwRegister: Longint; const filetime: TFileTime): HRESULT; stdcall;
  271. function GetTimeOfLastChange(const mkObjectName: IMoniker;
  272. out filetime: TFileTime): HRESULT; stdcall;
  273. function EnumRunning(out enumMoniker: IEnumMoniker): HRESULT; stdcall;
  274. end;
  275. {$EXTERNALSYM IRunningObjectTable}
  276. PBindOpts = ^TBindOpts;
  277. BIND_OPTS = record
  278. cbStruct: Longint;
  279. grfFlags: Longint;
  280. grfMode: Longint;
  281. dwTickCountDeadline: Longint;
  282. end;
  283. TBindOpts = BIND_OPTS;
  284. {$EXTERNALSYM BIND_OPTS}
  285. IBindCtx = interface(IUnknown)
  286. ['{0000000E-0000-0000-C000-000000000046}']
  287. function RegisterObjectBound(const unk: IUnknown): HRESULT; stdcall;
  288. function RevokeObjectBound(const unk: IUnknown): HRESULT; stdcall;
  289. function ReleaseBoundObjects: HRESULT; stdcall;
  290. function SetBindOptions(const bindopts: TBindOpts): HRESULT; stdcall;
  291. function GetBindOptions(var bindopts: TBindOpts): HRESULT; stdcall;
  292. function GetRunningObjectTable(out rot: IRunningObjectTable): HRESULT; stdcall;
  293. function RegisterObjectParam(pszKey: POleStr; const unk: IUnknown): HRESULT; stdcall;
  294. function GetObjectParam(pszKey: POleStr; out unk: IUnknown): HRESULT; stdcall;
  295. function EnumObjectParam(out Enum: IEnumString): HRESULT; stdcall;
  296. function RevokeObjectParam(pszKey: POleStr): HRESULT; stdcall;
  297. end;
  298. {$EXTERNALSYM IBindCtx}
  299. PIMoniker = ^IMoniker;
  300. {$EXTERNALSYM PIMoniker}
  301. IMoniker = interface(IPersistStream)
  302. ['{0000000F-0000-0000-C000-000000000046}']
  303. function BindToObject(const bc: IBindCtx; const mkToLeft: IMoniker;
  304. const iidResult: TIID; out vResult): HRESULT; stdcall;
  305. function BindToStorage(const bc: IBindCtx; const mkToLeft: IMoniker;
  306. const iid: TIID; out vObj): HRESULT; stdcall;
  307. function Reduce(const bc: IBindCtx; dwReduceHowFar: Longint;
  308. mkToLeft: PIMoniker; out mkReduced: IMoniker): HRESULT; stdcall;
  309. function ComposeWith(const mkRight: IMoniker; fOnlyIfNotGeneric: BOOL;
  310. out mkComposite: IMoniker): HRESULT; stdcall;
  311. function Enum(fForward: BOOL; out enumMoniker: IEnumMoniker): HRESULT; stdcall;
  312. function IsEqual(const mkOtherMoniker: IMoniker): HRESULT; stdcall;
  313. function Hash(out dwHash: Longint): HRESULT; stdcall;
  314. function IsRunning(const bc: IBindCtx; const mkToLeft: IMoniker;
  315. const mkNewlyRunning: IMoniker): HRESULT; stdcall;
  316. function GetTimeOfLastChange(const bc: IBindCtx; const mkToLeft: IMoniker;
  317. out filetime: TFileTime): HRESULT; stdcall;
  318. function Inverse(out mk: IMoniker): HRESULT; stdcall;
  319. function CommonPrefixWith(const mkOther: IMoniker;
  320. out mkPrefix: IMoniker): HRESULT; stdcall;
  321. function RelativePathTo(const mkOther: IMoniker;
  322. out mkRelPath: IMoniker): HRESULT; stdcall;
  323. function GetDisplayName(const bc: IBindCtx; const mkToLeft: IMoniker;
  324. out pszDisplayName: POleStr): HRESULT; stdcall;
  325. function ParseDisplayName(const bc: IBindCtx; const mkToLeft: IMoniker;
  326. pszDisplayName: POleStr; out chEaten: Longint;
  327. out mkOut: IMoniker): HRESULT; stdcall;
  328. function IsSystemMoniker(out dwMksys: Longint): HRESULT; stdcall;
  329. end;
  330. {$EXTERNALSYM IMoniker}
  331. {$EXTERNALSYM IEnumMoniker}
  332. IEnumMoniker = interface(IUnknown)
  333. ['{00000102-0000-0000-C000-000000000046}']
  334. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  335. function Skip(celt: Longint): HRESULT; stdcall;
  336. function Reset: HRESULT; stdcall;
  337. function Clone(out enm: IEnumMoniker): HRESULT; stdcall;
  338. end;
  339. IAdviseSink = interface(IUnknown)
  340. ['{0000010F-0000-0000-C000-000000000046}']
  341. procedure OnDataChange(const formatetc: TFormatEtc; const stgmed: TStgMedium); stdcall;
  342. procedure OnViewChange(dwAspect: Longint; lindex: Longint); stdcall;
  343. procedure OnRename(const mk: IMoniker); stdcall;
  344. procedure OnSave; stdcall;
  345. procedure OnClose; stdcall;
  346. end;
  347. {$EXTERNALSYM IAdviseSink}
  348. PStatData = ^TStatData;
  349. STATDATA = record
  350. formatetc: TFormatEtc;
  351. advf: Longint;
  352. advSink: IAdviseSink;
  353. dwConnection: Longint;
  354. end;
  355. TStatData = STATDATA;
  356. {$EXTERNALSYM STATDATA}
  357. IEnumSTATDATA = interface(IUnknown)
  358. ['{00000105-0000-0000-C000-000000000046}']
  359. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  360. function Skip(celt: Longint): HRESULT; stdcall;
  361. function Reset: HRESULT; stdcall;
  362. function Clone(out Enum: IEnumSTATDATA): HRESULT; stdcall;
  363. end;
  364. {$EXTERNALSYM IEnumSTATDATA}
  365. IDataObject = interface(IUnknown)
  366. ['{0000010E-0000-0000-C000-000000000046}']
  367. function GetData(const formatetcIn: TFormatEtc; out medium: TStgMedium): HRESULT; stdcall;
  368. function GetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium): HRESULT; stdcall;
  369. function QueryGetData(const formatetc: TFormatEtc): HRESULT; stdcall;
  370. function GetCanonicalFormatEtc(const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HRESULT; stdcall;
  371. function SetData(const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HRESULT; stdcall;
  372. function EnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFORMATETC): HRESULT; stdcall;
  373. function DAdvise(const formatetc: TFormatEtc; advf: Longint;
  374. const advSink: IAdviseSink; out dwConnection: Longint): HRESULT; stdcall;
  375. function DUnadvise(dwConnection: Longint): HRESULT; stdcall;
  376. function EnumDAdvise(out enumAdvise: IEnumSTATDATA): HRESULT; stdcall;
  377. end;
  378. {$EXTERNALSYM IDataObject}
  379. IEnumConnectionPoints = interface
  380. ['{B196B285-BAB4-101A-B69C-00AA00341D07}']
  381. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  382. function Skip(celt: Longint): HRESULT; stdcall;
  383. function Reset: HRESULT; stdcall;
  384. function Clone(out Enum: IEnumConnectionPoints): HRESULT; stdcall;
  385. end;
  386. {$EXTERNALSYM IEnumConnectionPoints}
  387. IEnumConnections = interface
  388. ['{B196B287-BAB4-101A-B69C-00AA00341D07}']
  389. function Next(celt: Longint; out elt; pceltFetched: PLongint): HRESULT; stdcall;
  390. function Skip(celt: Longint): HRESULT; stdcall;
  391. function Reset: HRESULT; stdcall;
  392. function Clone(out Enum: IEnumConnections): HRESULT; stdcall;
  393. end;
  394. {$EXTERNALSYM IEnumConnections}
  395. IConnectionPoint = interface
  396. ['{B196B286-BAB4-101A-B69C-00AA00341D07}']
  397. function GetConnectionInterface(out iid: TIID): HRESULT; stdcall;
  398. function GetConnectionPointContainer(out cpc: IConnectionPointContainer): HRESULT; stdcall;
  399. function Advise(const unkSink: IUnknown; out dwCookie: Longint): HRESULT; stdcall;
  400. function Unadvise(dwCookie: Longint): HRESULT; stdcall;
  401. function EnumConnections(out Enum: IEnumConnections): HRESULT; stdcall;
  402. end;
  403. {$EXTERNALSYM IConnectionPoint}
  404. IConnectionPointContainer = interface
  405. ['{B196B284-BAB4-101A-B69C-00AA00341D07}']
  406. function EnumConnectionPoints(out Enum: IEnumConnectionPoints): HRESULT; stdcall;
  407. function FindConnectionPoint(const iid: TIID; out cp: IConnectionPoint): HRESULT; stdcall;
  408. end;
  409. {$EXTERNALSYM IConnectionPointContainer}
  410. PPropVariant = ^TPropVariant;
  411. CAUB = packed record
  412. cElems: ULONG;
  413. pElems: PByte;
  414. end;
  415. {$EXTERNALSYM CAUB}
  416. PCAUB = ^TCAUB;
  417. TCAUB = CAUB;
  418. CAI = packed record
  419. cElems: ULONG;
  420. pElems: PShortInt;
  421. end;
  422. {$EXTERNALSYM CAI}
  423. PCAI = ^TCAI;
  424. TCAI = CAI;
  425. CAUI = packed record
  426. cElems: ULONG;
  427. pElems: PWord;
  428. end;
  429. {$EXTERNALSYM CAUI}
  430. PCAUI = ^TCAUI;
  431. TCAUI = CAUI;
  432. CAL = packed record
  433. cElems: ULONG;
  434. pElems: PLongint;
  435. end;
  436. {$EXTERNALSYM CAL}
  437. PCAL = ^TCAL;
  438. TCAL = CAL;
  439. CAUL = packed record
  440. cElems: ULONG;
  441. pElems: PULONG;
  442. end;
  443. {$EXTERNALSYM CAUL}
  444. PCAUL = ^TCAUL;
  445. TCAUL = CAUL;
  446. CAFLT = packed record
  447. cElems: ULONG;
  448. pElems: PSingle;
  449. end;
  450. {$EXTERNALSYM CAFLT}
  451. PCAFLT = ^TCAFLT;
  452. TCAFLT = CAFLT;
  453. CADBL = packed record
  454. cElems: ULONG;
  455. pElems: PDouble;
  456. end;
  457. {$EXTERNALSYM CADBL}
  458. PCADBL = ^TCADBL;
  459. TCADBL = CADBL;
  460. CACY = packed record
  461. cElems: ULONG;
  462. pElems: PCurrency;
  463. end;
  464. {$EXTERNALSYM CACY}
  465. PCACY = ^TCACY;
  466. TCACY = CACY;
  467. CADATE = packed record
  468. cElems: ULONG;
  469. pElems: POleDate;
  470. end;
  471. {$EXTERNALSYM CADATE}
  472. PCADATE = ^TCADATE;
  473. TCADATE = CADATE;
  474. CABSTR = packed record
  475. cElems: ULONG;
  476. pElems: PBSTR;
  477. end;
  478. {$EXTERNALSYM CABSTR}
  479. PCABSTR = ^TCABSTR;
  480. TCABSTR = CABSTR;
  481. CABOOL = packed record
  482. cElems: ULONG;
  483. pElems: POleBool;
  484. end;
  485. {$EXTERNALSYM CABOOL}
  486. PCABOOL = ^TCABOOL;
  487. TCABOOL = CABOOL;
  488. CASCODE = packed record
  489. cElems: ULONG;
  490. pElems: PSCODE;
  491. end;
  492. {$EXTERNALSYM CASCODE}
  493. PCASCODE = ^TCASCODE;
  494. TCASCODE = CASCODE;
  495. CAPROPVARIANT = packed record
  496. cElems: ULONG;
  497. pElems: PPropVariant;
  498. end;
  499. {$EXTERNALSYM CAPROPVARIANT}
  500. PCAPROPVARIANT = ^TCAPROPVARIANT;
  501. TCAPROPVARIANT = CAPROPVARIANT;
  502. CAH = packed record
  503. cElems: ULONG;
  504. pElems: PLargeInteger;
  505. end;
  506. {$EXTERNALSYM CAH}
  507. PCAH = ^TCAH;
  508. TCAH = CAH;
  509. CAUH = packed record
  510. cElems: ULONG;
  511. pElems: PULargeInteger;
  512. end;
  513. {$EXTERNALSYM CAUH}
  514. PCAUH = ^TCAUH;
  515. TCAUH = CAUH;
  516. CALPSTR = packed record
  517. cElems: ULONG;
  518. pElems: PLPSTR;
  519. end;
  520. {$EXTERNALSYM CALPSTR}
  521. PCALPSTR = ^TCALPSTR;
  522. TCALPSTR = CALPSTR;
  523. CALPWSTR = packed record
  524. cElems: ULONG;
  525. pElems: PLPWSTR;
  526. end;
  527. {$EXTERNALSYM CALPWSTR}
  528. PCALPWSTR = ^TCALPWSTR;
  529. TCALPWSTR = CALPWSTR;
  530. CAFILETIME = packed record
  531. cElems: ULONG;
  532. pElems: PFileTime;
  533. end;
  534. {$EXTERNALSYM CAFILETIME}
  535. PCAFILETIME = ^TCAFILETIME;
  536. TCAFILETIME = CAFILETIME;
  537. CACLIPDATA = packed record
  538. cElems: ULONG;
  539. pElems: PClipData;
  540. end;
  541. {$EXTERNALSYM CACLIPDATA}
  542. PCACLIPDATA = ^TCACLIPDATA;
  543. TCACLIPDATA = CACLIPDATA;
  544. CACLSID = packed record
  545. cElems: ULONG;
  546. pElems: PCLSID;
  547. end;
  548. {$EXTERNALSYM CACLSID}
  549. PCACLSID = ^TCACLSID;
  550. TCACLSID = CACLSID;
  551. PROPVARIANT = packed record
  552. vt: TVarType;
  553. wReserved1: Word;
  554. wReserved2: Word;
  555. wReserved3: Word;
  556. case Integer of
  557. 0: (bVal: Byte);
  558. 1: (iVal: Smallint);
  559. 2: (uiVal: Word);
  560. 3: (boolVal: TOleBool);
  561. 4: (bool: TOleBool);
  562. 5: (lVal: Longint);
  563. 6: (ulVal: Cardinal);
  564. 7: (fltVal: Single);
  565. 8: (scode: SCODE);
  566. 9: (hVal: LARGE_INTEGER);
  567. 10: (uhVal: ULARGE_INTEGER);
  568. 11: (dblVal: Double);
  569. 12: (cyVal: Currency);
  570. 13: (date: TOleDate);
  571. 14: (filetime: TFileTime);
  572. 15: (puuid: PGUID);
  573. 16: (blob: TBlob);
  574. 17: (pclipdata: PClipData);
  575. 18: (pStream: Pointer); // IStream
  576. 19: (pStorage: Pointer); // IStorage
  577. 20: (bstrVal: TBStr);
  578. 21: (pszVal: PAnsiChar);
  579. 22: (pwszVal: PWideChar);
  580. 23: (caub: TCAUB);
  581. 24: (cai: TCAI);
  582. 25: (caui: TCAUI);
  583. 26: (cabool: TCABOOL);
  584. 27: (cal: TCAL);
  585. 28: (caul: TCAUL);
  586. 29: (caflt: TCAFLT);
  587. 30: (cascode: TCASCODE);
  588. 31: (cah: TCAH);
  589. 32: (cauh: TCAUH);
  590. 33: (cadbl: TCADBL);
  591. 34: (cacy: TCACY);
  592. 35: (cadate: TCADATE);
  593. 36: (cafiletime: TCAFILETIME);
  594. 37: (cauuid: TCACLSID);
  595. 38: (caclipdata: TCACLIPDATA);
  596. 39: (cabstr: TCABSTR);
  597. 40: (calpstr: TCALPSTR);
  598. 41: (calpwstr: TCALPWSTR );
  599. 42: (capropvar: TCAPROPVARIANT);
  600. end;
  601. {$EXTERNALSYM PROPVARIANT}
  602. TPropVariant = PROPVARIANT;
  603. PROPSPEC = packed record
  604. ulKind: ULONG;
  605. case Integer of
  606. 0: (propid: TPropID);
  607. 1: (lpwstr: POleStr);
  608. end;
  609. {$EXTERNALSYM PROPSPEC}
  610. PPropSpec = ^TPropSpec;
  611. TPropSpec = PROPSPEC;
  612. STATPROPSTG = record
  613. lpwstrName: POleStr;
  614. propid: TPropID;
  615. vt: TVarType;
  616. end;
  617. {$EXTERNALSYM STATPROPSTG}
  618. PStatPropStg = ^TStatPropStg;
  619. TStatPropStg = STATPROPSTG;
  620. STATPROPSETSTG = packed record
  621. fmtid: TFmtID;
  622. clsid: TClsID;
  623. grfFlags: DWORD;
  624. mtime: TFileTime;
  625. ctime: TFileTime;
  626. atime: TFileTime;
  627. dwOSVersion: DWORD;
  628. end;
  629. {$EXTERNALSYM STATPROPSETSTG}
  630. PStatPropSetStg = ^TStatPropSetStg;
  631. TStatPropSetStg = STATPROPSETSTG;
  632. IPropertyStorage = interface(IUnknown)
  633. ['{00000138-0000-0000-C000-000000000046}']
  634. function ReadMultiple(cpspec: ULONG; rgpspec : PPropSpec; rgpropvar: PPropVariant): HRESULT; stdcall;
  635. function WriteMultiple(cpspec: ULONG; rgpspec : PPropSpec; rgpropvar: PPropVariant;
  636. propidNameFirst: TPropID): HRESULT; stdcall;
  637. function DeleteMultiple(cpspec: ULONG; rgpspec: PPropSpec): HRESULT; stdcall;
  638. function ReadPropertyNames(cpropid: ULONG; rgpropid: PPropID;
  639. rglpwstrName: PPOleStr): HRESULT; stdcall;
  640. function WritePropertyNames(cpropid: ULONG; rgpropid: PPropID;
  641. rglpwstrName: PPOleStr): HRESULT; stdcall;
  642. function DeletePropertyNames(cpropid: ULONG; rgpropid: PPropID): HRESULT; stdcall;
  643. function Commit(grfCommitFlags: DWORD): HRESULT; stdcall;
  644. function Revert: HRESULT; stdcall;
  645. function Enum(out ppenum: IEnumSTATPROPSTG): HRESULT; stdcall;
  646. function SetTimes(const pctime, patime, pmtime: TFileTime): HRESULT; stdcall;
  647. function SetClass(const clsid: TCLSID): HRESULT; stdcall;
  648. function Stat(pstatpsstg: PStatPropSetStg): HRESULT; stdcall;
  649. end;
  650. {$EXTERNALSYM IPropertyStorage}
  651. IPropertySetStorage = interface(IUnknown)
  652. ['{0000013A-0000-0000-C000-000000000046}']
  653. function Create(const rfmtid: TFmtID; const pclsid: TCLSID; grfFlags,
  654. grfMode: DWORD; out ppprstg: IPropertyStorage): HRESULT; stdcall;
  655. function Open(const rfmtid: TFmtID; grfMode: DWORD;
  656. out ppprstg: IPropertyStorage): HRESULT; stdcall;
  657. function Delete(const rfmtid: TFmtID): HRESULT; stdcall;
  658. function Enum(out ppenum: IEnumSTATPROPSETSTG): HRESULT; stdcall;
  659. end;
  660. {$EXTERNALSYM IPropertySetStorage}
  661. IEnumSTATPROPSTG = interface(IUnknown)
  662. ['{00000139-0000-0000-C000-000000000046}']
  663. function Next(celt: ULONG; out rgelt; pceltFetched: PULONG): HRESULT; stdcall;
  664. function Skip(celt: ULONG): HRESULT; stdcall;
  665. function Reset: HRESULT; stdcall;
  666. function Clone(out ppenum: IEnumSTATPROPSTG): HRESULT; stdcall;
  667. end;
  668. {$EXTERNALSYM IEnumSTATPROPSTG}
  669. IEnumSTATPROPSETSTG = interface(IUnknown)
  670. ['{0000013B-0000-0000-C000-000000000046}']
  671. function Next(celt: ULONG; out rgelt; pceltFetched: PULONG): HRESULT; stdcall;
  672. function Skip(celt: ULONG): HRESULT; stdcall;
  673. function Reset: HRESULT; stdcall;
  674. function Clone(out ppenum: IEnumSTATPROPSETSTG): HRESULT; stdcall;
  675. end;
  676. {$EXTERNALSYM IEnumSTATPROPSETSTG}
  677. IEnumStatStg = interface(IUnknown)
  678. ['{0000000D-0000-0000-C000-000000000046}']
  679. function Next(celt: Longint; out elt;
  680. pceltFetched: PLongint): HResult; stdcall;
  681. function Skip(celt: Longint): HResult; stdcall;
  682. function Reset: HResult; stdcall;
  683. function Clone(out enm: IEnumStatStg): HResult; stdcall;
  684. end;
  685. {$EXTERNALSYM IEnumStatStg}
  686. TSNB = ^POleStr;
  687. IStorage = interface(IUnknown)
  688. ['{0000000B-0000-0000-C000-000000000046}']
  689. function CreateStream(pwcsName: POleStr; grfMode: Longint; reserved1: Longint;
  690. reserved2: Longint; out stm: IStream): HRESULT; stdcall;
  691. function OpenStream(pwcsName: POleStr; reserved1: Pointer; grfMode: Longint;
  692. reserved2: Longint; out stm: IStream): HRESULT; stdcall;
  693. function CreateStorage(pwcsName: POleStr; grfMode: Longint;
  694. dwStgFmt: Longint; reserved2: Longint; out stg: IStorage): HRESULT; stdcall;
  695. function OpenStorage(pwcsName: POleStr; const stgPriority: IStorage;
  696. grfMode: Longint; snbExclude: TSNB; reserved: Longint; out stg: IStorage): HRESULT; stdcall;
  697. function CopyTo(ciidExclude: Longint; rgiidExclude: PIID;
  698. snbExclude: TSNB; const stgDest: IStorage): HRESULT; stdcall;
  699. function MoveElementTo(pwcsName: POleStr; const stgDest: IStorage;
  700. pwcsNewName: POleStr; grfFlags: Longint): HRESULT; stdcall;
  701. function Commit(grfCommitFlags: Longint): HRESULT; stdcall;
  702. function Revert: HRESULT; stdcall;
  703. function EnumElements(reserved1: Longint; reserved2: Pointer; reserved3: Longint;
  704. out enm: IEnumStatStg): HRESULT; stdcall;
  705. function DestroyElement(pwcsName: POleStr): HRESULT; stdcall;
  706. function RenameElement(pwcsOldName: POleStr; pwcsNewName: POleStr): HRESULT; stdcall;
  707. function SetElementTimes(pwcsName: POleStr; const ctime: TFileTime;
  708. const atime: TFileTime; const mtime: TFileTime): HRESULT; stdcall;
  709. function SetClass(const clsid: TCLSID): HRESULT; stdcall;
  710. function SetStateBits(grfStateBits: Longint; grfMask: Longint): HRESULT; stdcall;
  711. function Stat(out statstg: TStatStg; grfStatFlag: Longint): HRESULT; stdcall;
  712. end;
  713. {$EXTERNALSYM IStorage}
  714. implementation
  715. end.