PageRenderTime 887ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/delphi/nonvcl/lib/MiniHtmlHlp.pas

http://delphi-nonvcl-librarys.googlecode.com/
Pascal | 882 lines | 465 code | 68 blank | 349 comment | 8 complexity | b5ed23f7651847c0659cce982380f74b MD5 | raw file
  1. {******************************************************************}
  2. { }
  3. { Borland Delphi Runtime Library }
  4. { HTML Help interface unit }
  5. { }
  6. { Portions created by Microsoft are }
  7. { Copyright (C) 1995-1999 Microsoft Corporation. }
  8. { All Rights Reserved. }
  9. { }
  10. { The original file is: htmlhelp.h, released 12 May 1999. }
  11. { The original Pascal code is: HTMLHelp.pas, released 9 Jun 1999. }
  12. { The initial developer of the Pascal code is Marcel van Brakel }
  13. { (brakelm@bart.nl). }
  14. { }
  15. { Portions created by Marcel van Brakel are }
  16. { Copyright (C) 1999 Marcel van Brakel. }
  17. { }
  18. { Contributor(s): Robert Chandler (robert@helpware.net) }
  19. { Kurt Senfer (ks@siemens.dk) }
  20. { }
  21. { Obtained through: }
  22. { Joint Endeavour of Delphi Innovators (Project JEDI) }
  23. { }
  24. { You may retrieve the latest version of this file at the Project }
  25. { JEDI home page, located at http://delphi-jedi.org }
  26. { }
  27. { The contents of this file are used with permission, subject to }
  28. { the Mozilla Public License Version 1.1 (the "License"); you may }
  29. { not use this file except in compliance with the License. You may }
  30. { obtain a copy of the License at }
  31. { http://www.mozilla.org/MPL/MPL-1.1.html }
  32. { }
  33. { Software distributed under the License is distributed on an }
  34. { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
  35. { implied. See the License for the specific language governing }
  36. { rights and limitations under the License. }
  37. { }
  38. {******************************************************************}
  39. unit MiniHtmlHlp;
  40. interface
  41. (*$HPPEMIT ''*)
  42. (*$HPPEMIT '#include "htmlhelp.h"'*)
  43. (*$HPPEMIT ''*)
  44. (*$HPPEMIT 'typedef struct tagHH_LAST_ERROR'*)
  45. (*$HPPEMIT '{'*)
  46. (*$HPPEMIT ' int cbStruct ;'*)
  47. (*$HPPEMIT ' HRESULT hr ;'*)
  48. (*$HPPEMIT ' BSTR description ;'*)
  49. (*$HPPEMIT '} HH_LAST_ERROR ;'*)
  50. (*$HPPEMIT ''*)
  51. uses
  52. Windows;
  53. {$I HTMLHLP.INC}
  54. type
  55. {$IFDEF HTMLHELP12}
  56. {$IFNDEF _WIN64}
  57. DWORD_PTR = DWORD;
  58. {$ENDIF}
  59. {$ENDIF}
  60. PCSTR = LPCSTR;
  61. // Commands to pass to HtmlHelp()
  62. const
  63. HH_DISPLAY_TOPIC = $0000;
  64. {$EXTERNALSYM HH_DISPLAY_TOPIC}
  65. HH_HELP_FINDER = $0000; // WinHelp equivalent
  66. {$EXTERNALSYM HH_HELP_FINDER}
  67. HH_DISPLAY_TOC = $0001; // not currently implemented
  68. {$EXTERNALSYM HH_DISPLAY_TOC}
  69. HH_DISPLAY_INDEX = $0002; // not currently implemented
  70. {$EXTERNALSYM HH_DISPLAY_INDEX}
  71. HH_DISPLAY_SEARCH = $0003; // not currently implemented
  72. {$EXTERNALSYM HH_DISPLAY_SEARCH}
  73. HH_SET_WIN_TYPE = $0004;
  74. {$EXTERNALSYM HH_SET_WIN_TYPE}
  75. HH_GET_WIN_TYPE = $0005;
  76. {$EXTERNALSYM HH_GET_WIN_TYPE}
  77. HH_GET_WIN_HANDLE = $0006;
  78. {$EXTERNALSYM HH_GET_WIN_HANDLE}
  79. HH_ENUM_INFO_TYPE = $0007; // Get Info type name, call repeatedly to enumerate, -1 at end
  80. {$EXTERNALSYM HH_ENUM_INFO_TYPE}
  81. HH_SET_INFO_TYPE = $0008; // Add Info type to filter.
  82. {$EXTERNALSYM HH_SET_INFO_TYPE}
  83. HH_SYNC = $0009;
  84. {$EXTERNALSYM HH_SYNC}
  85. {$IFDEF HTMLHELP11}
  86. HH_ADD_NAV_UI = $000A; // not currently implemented
  87. {$EXTERNALSYM HH_ADD_NAV_UI}
  88. HH_ADD_BUTTON = $000B; // not currently implemented
  89. {$EXTERNALSYM HH_ADD_BUTTON}
  90. HH_GETBROWSER_APP = $000C; // not currently implemented
  91. {$EXTERNALSYM HH_GETBROWSER_APP}
  92. {$ENDIF}
  93. {$IFDEF HTMLHELP12}
  94. HH_RESERVED1 = $000A;
  95. {$EXTERNALSYM HH_RESERVED1}
  96. HH_RESERVED2 = $000B;
  97. {$EXTERNALSYM HH_RESERVED2}
  98. HH_RESERVED3 = $000C;
  99. {$EXTERNALSYM HH_RESERVED3}
  100. {$ENDIF}
  101. HH_KEYWORD_LOOKUP = $000D;
  102. {$EXTERNALSYM HH_KEYWORD_LOOKUP}
  103. HH_DISPLAY_TEXT_POPUP = $000E; // display string resource id or text in a popup window
  104. {$EXTERNALSYM HH_DISPLAY_TEXT_POPUP}
  105. HH_HELP_CONTEXT = $000F; // display mapped numeric value in dwData
  106. {$EXTERNALSYM HH_HELP_CONTEXT}
  107. HH_TP_HELP_CONTEXTMENU = $0010; // text popup help, same as WinHelp HELP_CONTEXTMENU
  108. {$EXTERNALSYM HH_TP_HELP_CONTEXTMENU}
  109. HH_TP_HELP_WM_HELP = $0011; // text popup help, same as WinHelp HELP_WM_HELP
  110. {$EXTERNALSYM HH_TP_HELP_WM_HELP}
  111. HH_CLOSE_ALL = $0012; // close all windows opened directly or indirectly by the caller
  112. {$EXTERNALSYM HH_CLOSE_ALL}
  113. HH_ALINK_LOOKUP = $0013; // ALink version of HH_KEYWORD_LOOKUP
  114. {$EXTERNALSYM HH_ALINK_LOOKUP}
  115. HH_GET_LAST_ERROR = $0014; // not currently implemented, See HHERROR.h
  116. {$EXTERNALSYM HH_GET_LAST_ERROR}
  117. HH_ENUM_CATEGORY = $0015; // Get category name, call repeatedly to enumerate, -1 at end
  118. {$EXTERNALSYM HH_ENUM_CATEGORY}
  119. HH_ENUM_CATEGORY_IT = $0016; // Get category info type members, call repeatedly to enumerate, -1 at end
  120. {$EXTERNALSYM HH_ENUM_CATEGORY_IT}
  121. HH_RESET_IT_FILTER = $0017; // Clear the info type filter of all info types.
  122. {$EXTERNALSYM HH_RESET_IT_FILTER}
  123. HH_SET_INCLUSIVE_FILTER = $0018; // set inclusive filtering method for untyped topics to be included in display
  124. {$EXTERNALSYM HH_SET_INCLUSIVE_FILTER}
  125. HH_SET_EXCLUSIVE_FILTER = $0019; // set exclusive filtering method for untyped topics to be excluded from display
  126. {$EXTERNALSYM HH_SET_EXCLUSIVE_FILTER}
  127. {$IFDEF HTMLHELP11}
  128. HH_SET_GUID = $001A; // For Microsoft Installer -- dwData is a pointer to the GUID string
  129. {$EXTERNALSYM HH_SET_GUID}
  130. {$ENDIF}
  131. {$IFDEF HTMLHELP12}
  132. HH_INITIALIZE = $001C; // Initializes the help system.
  133. {$EXTERNALSYM HH_INITIALIZE}
  134. HH_UNINITIALIZE = $001D; // Uninitializes the help system.
  135. {$EXTERNALSYM HH_UNINITIALIZE}
  136. HH_PRETRANSLATEMESSAGE = $00FD; // Pumps messages. (NULL, NULL, MSG*).
  137. {$EXTERNALSYM HH_PRETRANSLATEMESSAGE}
  138. HH_SET_GLOBAL_PROPERTY = $00FC; // Set a global property. (NULL, NULL, HH_GPROP)
  139. {$EXTERNALSYM HH_SET_GLOBAL_PROPERTY}
  140. {$ENDIF}
  141. {$IFDEF HTMLHELP11}
  142. HH_INTERNAL = $00FF; // Used internally.
  143. {$EXTERNALSYM HH_INTERNAL}
  144. {$ENDIF}
  145. {$IFDEF HTMLHELP12}
  146. HHWIN_PROP_TAB_AUTOHIDESHOW = (1 shl 0); // Automatically hide/show tri-pane window
  147. {$EXTERNALSYM HHWIN_PROP_TAB_AUTOHIDESHOW}
  148. {$ENDIF}
  149. HHWIN_PROP_ONTOP = (1 shl 1); // Top-most window (not currently implemented)
  150. {$EXTERNALSYM HHWIN_PROP_ONTOP}
  151. HHWIN_PROP_NOTITLEBAR = (1 shl 2); // no title bar
  152. {$EXTERNALSYM HHWIN_PROP_NOTITLEBAR}
  153. HHWIN_PROP_NODEF_STYLES = (1 shl 3); // no default window styles (only HH_WINTYPE.dwStyles)
  154. {$EXTERNALSYM HHWIN_PROP_NODEF_STYLES}
  155. HHWIN_PROP_NODEF_EXSTYLES = (1 shl 4); // no default extended window styles (only HH_WINTYPE.dwExStyles)
  156. {$EXTERNALSYM HHWIN_PROP_NODEF_EXSTYLES}
  157. HHWIN_PROP_TRI_PANE = (1 shl 5); // use a tri-pane window
  158. {$EXTERNALSYM HHWIN_PROP_TRI_PANE}
  159. HHWIN_PROP_NOTB_TEXT = (1 shl 6); // no text on toolbar buttons
  160. {$EXTERNALSYM HHWIN_PROP_NOTB_TEXT}
  161. HHWIN_PROP_POST_QUIT = (1 shl 7); // post WM_QUIT message when window closes
  162. {$EXTERNALSYM HHWIN_PROP_POST_QUIT}
  163. HHWIN_PROP_AUTO_SYNC = (1 shl 8); // automatically ssync contents and index
  164. {$EXTERNALSYM HHWIN_PROP_AUTO_SYNC}
  165. HHWIN_PROP_TRACKING = (1 shl 9); // send tracking notification messages
  166. {$EXTERNALSYM HHWIN_PROP_TRACKING}
  167. HHWIN_PROP_TAB_SEARCH = (1 shl 10); // include search tab in navigation pane
  168. {$EXTERNALSYM HHWIN_PROP_TAB_SEARCH}
  169. HHWIN_PROP_TAB_HISTORY = (1 shl 11); // include history tab in navigation pane
  170. {$EXTERNALSYM HHWIN_PROP_TAB_HISTORY}
  171. {$IFDEF HTMLHELP11}
  172. HHWIN_PROP_TAB_BOOKMARKS = (1 shl 12); // include bookmark tab in navigation pane
  173. {$EXTERNALSYM HHWIN_PROP_TAB_BOOKMARKS}
  174. {$ENDIF}
  175. {$IFDEF HTMLHELP12}
  176. HHWIN_PROP_TAB_FAVORITES = (1 shl 12); // include favorites tab in navigation pane
  177. {$EXTERNALSYM HHWIN_PROP_TAB_FAVORITES}
  178. {$ENDIF}
  179. HHWIN_PROP_CHANGE_TITLE = (1 shl 13); // Put current HTML title in title bar
  180. {$EXTERNALSYM HHWIN_PROP_CHANGE_TITLE}
  181. HHWIN_PROP_NAV_ONLY_WIN = (1 shl 14); // Only display the navigation window
  182. {$EXTERNALSYM HHWIN_PROP_NAV_ONLY_WIN}
  183. HHWIN_PROP_NO_TOOLBAR = (1 shl 15); // Don't display a toolbar
  184. {$EXTERNALSYM HHWIN_PROP_NO_TOOLBAR}
  185. HHWIN_PROP_MENU = (1 shl 16); // Menu
  186. {$EXTERNALSYM HHWIN_PROP_MENU}
  187. HHWIN_PROP_TAB_ADVSEARCH = (1 shl 17); // Advanced FTS UI.
  188. {$EXTERNALSYM HHWIN_PROP_TAB_ADVSEARCH}
  189. HHWIN_PROP_USER_POS = (1 shl 18); // After initial creation, user controls window size/Position
  190. {$EXTERNALSYM HHWIN_PROP_USER_POS}
  191. {$IFDEF HTMLHELP12}
  192. HHWIN_PROP_TAB_CUSTOM1 = (1 shl 19); // Use custom tab #1
  193. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM1}
  194. HHWIN_PROP_TAB_CUSTOM2 = (1 shl 20); // Use custom tab #2
  195. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM2}
  196. HHWIN_PROP_TAB_CUSTOM3 = (1 shl 21); // Use custom tab #3
  197. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM3}
  198. HHWIN_PROP_TAB_CUSTOM4 = (1 shl 22); // Use custom tab #4
  199. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM4}
  200. HHWIN_PROP_TAB_CUSTOM5 = (1 shl 23); // Use custom tab #5
  201. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM5}
  202. HHWIN_PROP_TAB_CUSTOM6 = (1 shl 24); // Use custom tab #6
  203. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM6}
  204. HHWIN_PROP_TAB_CUSTOM7 = (1 shl 25); // Use custom tab #7
  205. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM7}
  206. HHWIN_PROP_TAB_CUSTOM8 = (1 shl 26); // Use custom tab #8
  207. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM8}
  208. HHWIN_PROP_TAB_CUSTOM9 = (1 shl 27); // Use custom tab #9
  209. {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM9}
  210. HHWIN_TB_MARGIN = (1 shl 28); // the window type has a margin
  211. {$EXTERNALSYM HHWIN_TB_MARGIN}
  212. {$ENDIF}
  213. HHWIN_PARAM_PROPERTIES = (1 shl 1); // valid fsWinProperties
  214. {$EXTERNALSYM HHWIN_PARAM_PROPERTIES}
  215. HHWIN_PARAM_STYLES = (1 shl 2); // valid dwStyles
  216. {$EXTERNALSYM HHWIN_PARAM_STYLES}
  217. HHWIN_PARAM_EXSTYLES = (1 shl 3); // valid dwExStyles
  218. {$EXTERNALSYM HHWIN_PARAM_EXSTYLES}
  219. HHWIN_PARAM_RECT = (1 shl 4); // valid rcWindowPos
  220. {$EXTERNALSYM HHWIN_PARAM_RECT}
  221. HHWIN_PARAM_NAV_WIDTH = (1 shl 5); // valid iNavWidth
  222. {$EXTERNALSYM HHWIN_PARAM_NAV_WIDTH}
  223. HHWIN_PARAM_SHOWSTATE = (1 shl 6); // valid nShowState
  224. {$EXTERNALSYM HHWIN_PARAM_SHOWSTATE}
  225. HHWIN_PARAM_INFOTYPES = (1 shl 7); // valid apInfoTypes
  226. {$EXTERNALSYM HHWIN_PARAM_INFOTYPES}
  227. HHWIN_PARAM_TB_FLAGS = (1 shl 8); // valid fsToolBarFlags
  228. {$EXTERNALSYM HHWIN_PARAM_TB_FLAGS}
  229. HHWIN_PARAM_EXPANSION = (1 shl 9); // valid fNotExpanded
  230. {$EXTERNALSYM HHWIN_PARAM_EXPANSION}
  231. HHWIN_PARAM_TABPOS = (1 shl 10); // valid tabpos
  232. {$EXTERNALSYM HHWIN_PARAM_TABPOS}
  233. HHWIN_PARAM_TABORDER = (1 shl 11); // valid taborder
  234. {$EXTERNALSYM HHWIN_PARAM_TABORDER}
  235. HHWIN_PARAM_HISTORY_COUNT = (1 shl 12); // valid cHistory
  236. {$EXTERNALSYM HHWIN_PARAM_HISTORY_COUNT}
  237. HHWIN_PARAM_CUR_TAB = (1 shl 13); // valid curNavType
  238. {$EXTERNALSYM HHWIN_PARAM_CUR_TAB}
  239. HHWIN_BUTTON_EXPAND = (1 shl 1); // Expand/contract button
  240. {$EXTERNALSYM HHWIN_BUTTON_EXPAND}
  241. HHWIN_BUTTON_BACK = (1 shl 2); // Back button
  242. {$EXTERNALSYM HHWIN_BUTTON_BACK}
  243. HHWIN_BUTTON_FORWARD = (1 shl 3); // Forward button
  244. {$EXTERNALSYM HHWIN_BUTTON_FORWARD}
  245. HHWIN_BUTTON_STOP = (1 shl 4); // Stop button
  246. {$EXTERNALSYM HHWIN_BUTTON_STOP}
  247. HHWIN_BUTTON_REFRESH = (1 shl 5); // Refresh button
  248. {$EXTERNALSYM HHWIN_BUTTON_REFRESH}
  249. HHWIN_BUTTON_HOME = (1 shl 6); // Home button
  250. {$EXTERNALSYM HHWIN_BUTTON_HOME}
  251. HHWIN_BUTTON_BROWSE_FWD = (1 shl 7); // not implemented
  252. {$EXTERNALSYM HHWIN_BUTTON_BROWSE_FWD}
  253. HHWIN_BUTTON_BROWSE_BCK = (1 shl 8); // not implemented
  254. {$EXTERNALSYM HHWIN_BUTTON_BROWSE_BCK}
  255. HHWIN_BUTTON_NOTES = (1 shl 9); // not implemented
  256. {$EXTERNALSYM HHWIN_BUTTON_NOTES}
  257. HHWIN_BUTTON_CONTENTS = (1 shl 10); // not implemented
  258. {$EXTERNALSYM HHWIN_BUTTON_CONTENTS}
  259. HHWIN_BUTTON_SYNC = (1 shl 11); // Sync button
  260. {$EXTERNALSYM HHWIN_BUTTON_SYNC}
  261. HHWIN_BUTTON_OPTIONS = (1 shl 12); // Options button
  262. {$EXTERNALSYM HHWIN_BUTTON_OPTIONS}
  263. HHWIN_BUTTON_PRINT = (1 shl 13); // Print button
  264. {$EXTERNALSYM HHWIN_BUTTON_PRINT}
  265. HHWIN_BUTTON_INDEX = (1 shl 14); // not implemented
  266. {$EXTERNALSYM HHWIN_BUTTON_INDEX}
  267. HHWIN_BUTTON_SEARCH = (1 shl 15); // not implemented
  268. {$EXTERNALSYM HHWIN_BUTTON_SEARCH}
  269. HHWIN_BUTTON_HISTORY = (1 shl 16); // not implemented
  270. {$EXTERNALSYM HHWIN_BUTTON_HISTORY}
  271. {$IFDEF HTMLHELP11}
  272. HHWIN_BUTTON_BOOKMARKS = (1 shl 17); // not implemented
  273. {$EXTERNALSYM HHWIN_BUTTON_BOOKMARKS}
  274. {$ENDIF}
  275. {$IFDEF HTMLHELP12}
  276. HHWIN_BUTTON_FAVORITES = (1 shl 17); // not implemented
  277. {$EXTERNALSYM HHWIN_BUTTON_FAVORITES}
  278. {$ENDIF}
  279. HHWIN_BUTTON_JUMP1 = (1 shl 18);
  280. {$EXTERNALSYM HHWIN_BUTTON_JUMP1}
  281. HHWIN_BUTTON_JUMP2 = (1 shl 19);
  282. {$EXTERNALSYM HHWIN_BUTTON_JUMP2}
  283. HHWIN_BUTTON_ZOOM = (1 shl 20);
  284. {$EXTERNALSYM HHWIN_BUTTON_ZOOM}
  285. HHWIN_BUTTON_TOC_NEXT = (1 shl 21);
  286. {$EXTERNALSYM HHWIN_BUTTON_TOC_NEXT}
  287. HHWIN_BUTTON_TOC_PREV = (1 shl 22);
  288. {$EXTERNALSYM HHWIN_BUTTON_TOC_PREV}
  289. HHWIN_DEF_BUTTONS = HHWIN_BUTTON_EXPAND or HHWIN_BUTTON_BACK or
  290. HHWIN_BUTTON_OPTIONS or HHWIN_BUTTON_PRINT;
  291. {$EXTERNALSYM HHWIN_DEF_BUTTONS}
  292. // Button IDs
  293. IDTB_EXPAND = 200;
  294. {$EXTERNALSYM IDTB_EXPAND}
  295. IDTB_CONTRACT = 201;
  296. {$EXTERNALSYM IDTB_CONTRACT}
  297. IDTB_STOP = 202;
  298. {$EXTERNALSYM IDTB_STOP}
  299. IDTB_REFRESH = 203;
  300. {$EXTERNALSYM IDTB_REFRESH}
  301. IDTB_BACK = 204;
  302. {$EXTERNALSYM IDTB_BACK}
  303. IDTB_HOME = 205;
  304. {$EXTERNALSYM IDTB_HOME}
  305. IDTB_SYNC = 206;
  306. {$EXTERNALSYM IDTB_SYNC}
  307. IDTB_PRINT = 207;
  308. {$EXTERNALSYM IDTB_PRINT}
  309. IDTB_OPTIONS = 208;
  310. {$EXTERNALSYM IDTB_OPTIONS}
  311. IDTB_FORWARD = 209;
  312. {$EXTERNALSYM IDTB_FORWARD}
  313. IDTB_NOTES = 210; // not implemented
  314. {$EXTERNALSYM IDTB_NOTES}
  315. IDTB_BROWSE_FWD = 211;
  316. {$EXTERNALSYM IDTB_BROWSE_FWD}
  317. IDTB_BROWSE_BACK = 212;
  318. {$EXTERNALSYM IDTB_BROWSE_BACK}
  319. IDTB_CONTENTS = 213; // not implemented
  320. {$EXTERNALSYM IDTB_CONTENTS}
  321. IDTB_INDEX = 214; // not implemented
  322. {$EXTERNALSYM IDTB_INDEX}
  323. IDTB_SEARCH = 215; // not implemented
  324. {$EXTERNALSYM IDTB_SEARCH}
  325. IDTB_HISTORY = 216; // not implemented
  326. {$EXTERNALSYM IDTB_HISTORY}
  327. {$IFDEF HTMLHELP11}
  328. IDTB_BOOKMARKS = 217; // not implemented
  329. {$EXTERNALSYM IDTB_BOOKMARKS}
  330. {$ENDIF}
  331. {$IFDEF HTMLHELP12}
  332. IDTB_FAVORITES = 217; // not implemented
  333. {$EXTERNALSYM IDTB_FAVORITES}
  334. {$ENDIF}
  335. IDTB_JUMP1 = 218;
  336. {$EXTERNALSYM IDTB_JUMP1}
  337. IDTB_JUMP2 = 219;
  338. {$EXTERNALSYM IDTB_JUMP2}
  339. IDTB_CUSTOMIZE = 221;
  340. {$EXTERNALSYM IDTB_CUSTOMIZE}
  341. IDTB_ZOOM = 222;
  342. {$EXTERNALSYM IDTB_ZOOM}
  343. IDTB_TOC_NEXT = 223;
  344. {$EXTERNALSYM IDTB_TOC_NEXT}
  345. IDTB_TOC_PREV = 224;
  346. {$EXTERNALSYM IDTB_TOC_PREV}
  347. // Notification codes
  348. HHN_FIRST = -860;
  349. {$EXTERNALSYM HHN_FIRST}
  350. HHN_LAST = -879;
  351. {$EXTERNALSYM HHN_LAST}
  352. HHN_NAVCOMPLETE = (HHN_FIRST - 0);
  353. {$EXTERNALSYM HHN_NAVCOMPLETE}
  354. HHN_TRACK = (HHN_FIRST - 1);
  355. {$EXTERNALSYM HHN_TRACK}
  356. HHN_WINDOW_CREATE = (HHN_FIRST - 2);
  357. {$EXTERNALSYM HHN_WINDOW_CREATE}
  358. type
  359. PHHLastError = ^THHLastError;
  360. tagHH_LAST_ERROR = packed record
  361. cbStruct: Integer; // size of this structure
  362. hr: HRESULT; // the last error code.
  363. description: PWideChar; // a description of the error (unicode string - BSTR).
  364. end;
  365. THHLastError = tagHH_LAST_ERROR;
  366. PHHNNotify = ^THHNNotify;
  367. tagHHN_NOTIFY = packed record
  368. hdr: NMHDR;
  369. pszUrl: PCSTR; // multibyte null-terminated string
  370. end;
  371. {$EXTERNALSYM tagHHN_NOTIFY}
  372. HHN_NOTIFY = tagHHN_NOTIFY;
  373. {$EXTERNALSYM HHN_NOTIFY}
  374. THHNNotify = tagHHN_NOTIFY;
  375. PHHPopup = ^THHPopup;
  376. tagHH_POPUP = packed record
  377. cbStruct: Integer; // sizeof this structure
  378. hinst: HINST; // instance handle for string resource
  379. idString: UINT; // string resource id, or text id if pszFile is specified in HtmlHelp call
  380. pszText: LPCTSTR; // used if idString is zero
  381. pt: TPoint; // top center of popup window
  382. clrForeGround: TColorRef; // use -1 for default
  383. clrBackground: TColorRef; // use -1 for default
  384. rcMargins: TRect; // amount of space between edges of window and text, -1 for each member to ignore
  385. pszFont: LPCTSTR; // facename, point size, char set, BOLD ITALIC UNDERLINE
  386. end;
  387. {$EXTERNALSYM tagHH_POPUP}
  388. HH_POPUP = tagHH_POPUP;
  389. {$EXTERNALSYM HH_POPUP}
  390. THHPopup = tagHH_POPUP;
  391. PHHAKLink = ^THHAKLink;
  392. tagHH_AKLINK = packed record
  393. cbStruct: Integer; // sizeof this structure
  394. fReserved: BOOL; // must be FALSE (really!)
  395. pszKeywords: LPCTSTR; // semi-colon separated keywords
  396. pszUrl: LPCTSTR; // URL to jump to if no keywords found (may be NULL)
  397. pszMsgText: LPCTSTR; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
  398. pszMsgTitle: LPCTSTR; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
  399. pszWindow: LPCTSTR; // Window to display URL in
  400. fIndexOnFail: BOOL; // Displays index if keyword lookup fails.
  401. end;
  402. {$EXTERNALSYM tagHH_AKLINK}
  403. HH_AKLINK = tagHH_AKLINK;
  404. {$EXTERNALSYM HH_AKLINK}
  405. THHAKLink = tagHH_AKLINK;
  406. const
  407. HHWIN_NAVTYPE_TOC = 0;
  408. {$EXTERNALSYM HHWIN_NAVTYPE_TOC}
  409. HHWIN_NAVTYPE_INDEX = 1;
  410. {$EXTERNALSYM HHWIN_NAVTYPE_INDEX}
  411. HHWIN_NAVTYPE_SEARCH = 2;
  412. {$EXTERNALSYM HHWIN_NAVTYPE_SEARCH}
  413. {$IFDEF HTMLHELP11}
  414. HHWIN_NAVTYPE_BOOKMARKS = 3;
  415. {$EXTERNALSYM HHWIN_NAVTYPE_BOOKMARKS}
  416. HHWIN_NAVTYPE_HISTORY = 4; //not implemented
  417. {$EXTERNALSYM HHWIN_NAVTYPE_HISTORY}
  418. {$ENDIF}
  419. {$IFDEF HTMLHELP12}
  420. HHWIN_NAVTYPE_FAVORITES = 3;
  421. {$EXTERNALSYM HHWIN_NAVTYPE_FAVORITES}
  422. HHWIN_NAVTYPE_HISTORY = 4; //not implemented
  423. {$EXTERNALSYM HHWIN_NAVTYPE_HISTORY}
  424. HHWIN_NAVTYPE_AUTHOR = 5;
  425. {$EXTERNALSYM HHWIN_NAVTYPE_AUTHOR}
  426. HHWIN_NAVTYPE_CUSTOM_FIRST = 11;
  427. {$EXTERNALSYM HHWIN_NAVTYPE_CUSTOM_FIRST}
  428. {$ENDIF}
  429. IT_INCLUSIVE = 0;
  430. {$EXTERNALSYM IT_INCLUSIVE}
  431. IT_EXCLUSIVE = 1;
  432. {$EXTERNALSYM IT_EXCLUSIVE}
  433. IT_HIDDEN = 2;
  434. {$EXTERNALSYM IT_HIDDEN}
  435. type
  436. PHHEnumIT = ^THHEnumIT;
  437. tagHH_ENUM_IT = packed record
  438. cbStruct: Integer; // size of this structure
  439. iType: Integer; // the type of the information type ie. Inclusive, Exclusive, or Hidden
  440. pszCatName: LPCSTR; // Set to the name of the Category to enumerate the info types in a category; else NULL
  441. pszITName: LPCSTR; // volitile pointer to the name of the infotype. Allocated by call. Caller responsible for freeing
  442. pszITDescription: LPCSTR; // volitile pointer to the description of the infotype.
  443. end;
  444. {$EXTERNALSYM tagHH_ENUM_IT}
  445. HH_ENUM_IT = tagHH_ENUM_IT;
  446. {$EXTERNALSYM HH_ENUM_IT}
  447. PHH_ENUM_IT = ^tagHH_ENUM_IT;
  448. {$EXTERNALSYM PHH_ENUM_IT}
  449. THHEnumIT = tagHH_ENUM_IT;
  450. PHHEnumCat = ^THHEnumCat;
  451. tagHH_ENUM_CAT = packed record
  452. cbStruct: Integer; // size of this structure
  453. pszCatName: LPCSTR; // volitile pointer to the category name
  454. pszCatDescription: LPCSTR; // volitile pointer to the category description
  455. end;
  456. {$EXTERNALSYM tagHH_ENUM_CAT}
  457. HH_ENUM_CAT = tagHH_ENUM_CAT;
  458. {$EXTERNALSYM HH_ENUM_CAT}
  459. PHH_ENUM_CAT = ^tagHH_ENUM_CAT;
  460. {$EXTERNALSYM PHH_ENUM_CAT}
  461. THHEnumCat = tagHH_ENUM_CAT;
  462. PHHSetInfoType = ^THHSetInfoType;
  463. tagHH_SET_INFOTYPE = packed record
  464. cbStruct: Integer; // the size of this structure
  465. pszCatName: LPCSTR; // the name of the category, if any, the InfoType is a member of.
  466. pszInfoTypeName: LPCSTR; // the name of the info type to add to the filter
  467. end;
  468. {$EXTERNALSYM tagHH_SET_INFOTYPE}
  469. HH_SET_INFOTYPE = tagHH_SET_INFOTYPE;
  470. {$EXTERNALSYM HH_SET_INFOTYPE}
  471. PHH_SET_INFOTYPE = ^tagHH_SET_INFOTYPE;
  472. {$EXTERNALSYM PHH_SET_INFOTYPE}
  473. THHSetInfoType = tagHH_SET_INFOTYPE;
  474. HH_INFOTYPE = DWORD;
  475. {$EXTERNALSYM HH_INFOTYPE}
  476. PHH_INFOTYPE = ^HH_INFOTYPE;
  477. {$EXTERNALSYM PHH_INFOTYPE}
  478. PHHInfoType = ^THHInfoType;
  479. THHInfoType = HH_INFOTYPE;
  480. const
  481. HHWIN_NAVTAB_TOP = 0;
  482. {$EXTERNALSYM HHWIN_NAVTAB_TOP}
  483. HHWIN_NAVTAB_LEFT = 1;
  484. {$EXTERNALSYM HHWIN_NAVTAB_LEFT}
  485. HHWIN_NAVTAB_BOTTOM = 2;
  486. {$EXTERNALSYM HHWIN_NAVTAB_BOTTOM}
  487. HH_MAX_TABS = 19;
  488. {$EXTERNALSYM HH_MAX_TABS}
  489. HH_TAB_CONTENTS = 0;
  490. {$EXTERNALSYM HH_TAB_CONTENTS}
  491. HH_TAB_INDEX = 1;
  492. {$EXTERNALSYM HH_TAB_INDEX}
  493. HH_TAB_SEARCH = 2;
  494. {$EXTERNALSYM HH_TAB_SEARCH}
  495. {$IFDEF HTMLHELP11}
  496. HH_TAB_BOOKMARKS = 3;
  497. {$EXTERNALSYM HH_TAB_BOOKMARKS}
  498. HH_TAB_HISTORY = 4;
  499. {$EXTERNALSYM HH_TAB_HISTORY}
  500. {$ENDIF}
  501. {$IFDEF HTMLHELP12}
  502. HH_TAB_FAVORITES = 3;
  503. {$EXTERNALSYM HH_TAB_FAVORITES}
  504. HH_TAB_HISTORY = 4;
  505. {$EXTERNALSYM HH_TAB_HISTORY}
  506. HH_TAB_AUTHOR = 5;
  507. {$EXTERNALSYM HH_TAB_AUTHOR}
  508. HH_TAB_CUSTOM_FIRST = 11;
  509. {$EXTERNALSYM HH_TAB_CUSTOM_FIRST}
  510. HH_TAB_CUSTOM_LAST = HH_MAX_TABS;
  511. {$EXTERNALSYM HH_TAB_CUSTOM_LAST}
  512. HH_MAX_TABS_CUSTOM = HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1;
  513. {$EXTERNALSYM HH_MAX_TABS_CUSTOM}
  514. {$ENDIF}
  515. // HH_DISPLAY_SEARCH Command Related Structures and Constants
  516. HH_FTS_DEFAULT_PROXIMITY = -1;
  517. {$EXTERNALSYM HH_FTS_DEFAULT_PROXIMITY}
  518. type
  519. PHHFtsQuery = ^THHFtsQuery;
  520. tagHH_FTS_QUERY = packed record
  521. cbStruct: Integer; // Sizeof structure in bytes.
  522. fUniCodeStrings: BOOL; // TRUE if all strings are unicode.
  523. pszSearchQuery: LPCTSTR; // String containing the search query.
  524. iProximity: LongInt; // Word proximity.
  525. fStemmedSearch: BOOL; // TRUE for StemmedSearch only.
  526. fTitleOnly: BOOL; // TRUE for Title search only.
  527. fExecute: BOOL; // TRUE to initiate the search.
  528. pszWindow: LPCTSTR; // Window to display in
  529. end;
  530. {$EXTERNALSYM tagHH_FTS_QUERY}
  531. HH_FTS_QUERY = tagHH_FTS_QUERY;
  532. {$EXTERNALSYM HH_FTS_QUERY}
  533. THHFtsQuery = tagHH_FTS_QUERY;
  534. PHHWinType = ^THHWinType;
  535. tagHH_WINTYPE = packed record
  536. cbStruct: Integer; // IN: size of this structure including all Information Types
  537. fUniCodeStrings: BOOL; // IN/OUT: TRUE if all strings are in UNICODE
  538. pszType: LPCTSTR; // IN/OUT: Name of a type of window
  539. fsValidMembers: DWORD; // IN: Bit flag of valid members (HHWIN_PARAM_)
  540. fsWinProperties: DWORD; // IN/OUT: Properties/attributes of the window (HHWIN_)
  541. pszCaption: LPCTSTR; // IN/OUT: Window title
  542. dwStyles: DWORD; // IN/OUT: Window styles
  543. dwExStyles: DWORD; // IN/OUT: Extended Window styles
  544. rcWindowPos: TRect; // IN: Starting position, OUT: current position
  545. nShowState: Integer; // IN: show state (e.g., SW_SHOW)
  546. hwndHelp: HWND; // OUT: window handle
  547. hwndCaller: HWND; // OUT: who called this window
  548. paInfoTypes: PHHInfoType; // IN: Pointer to an array of Information Types
  549. { The following members are only valid if HHWIN_PROP_TRI_PANE is set }
  550. hwndToolBar: HWND; // OUT: toolbar window in tri-pane window
  551. hwndNavigation: HWND; // OUT: navigation window in tri-pane window
  552. hwndHTML: HWND; // OUT: window displaying HTML in tri-pane window
  553. iNavWidth: Integer; // IN/OUT: width of navigation window
  554. rcHTML: TRect; // OUT: HTML window coordinates
  555. pszToc: LPCTSTR; // IN: Location of the table of contents file
  556. pszIndex: LPCTSTR; // IN: Location of the index file
  557. pszFile: LPCTSTR; // IN: Default location of the html file
  558. pszHome: LPCTSTR; // IN/OUT: html file to display when Home button is clicked
  559. fsToolBarFlags: DWORD; // IN: flags controling the appearance of the toolbar
  560. fNotExpanded: BOOL; // IN: TRUE/FALSE to contract or expand, OUT: current state
  561. curNavType: Integer; // IN/OUT: UI to display in the navigational pane
  562. tabpos: Integer; // IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
  563. idNotify: Integer; // IN: ID to use for WM_NOTIFY messages
  564. tabOrder: array[0..HH_MAX_TABS] of Byte; // IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
  565. cHistory: Integer; // IN/OUT: number of history items to keep (default is 30)
  566. pszJump1: LPCTSTR; // Text for HHWIN_BUTTON_JUMP1
  567. pszJump2: LPCTSTR; // Text for HHWIN_BUTTON_JUMP2
  568. pszUrlJump1: LPCTSTR; // URL for HHWIN_BUTTON_JUMP1
  569. pszUrlJump2: LPCTSTR; // URL for HHWIN_BUTTON_JUMP2
  570. rcMinSize: TRect; // Minimum size for window (ignored in version 1)
  571. cbInfoTypes: Integer; // size of paInfoTypes;
  572. {$IFDEF HTMLHELP12}
  573. pszCustomTabs: LPCTSTR; // multiple zero-terminated Strings
  574. {$ENDIF}
  575. end;
  576. {$EXTERNALSYM tagHH_WINTYPE}
  577. HH_WINTYPE = tagHH_WINTYPE;
  578. {$EXTERNALSYM HH_WINTYPE}
  579. PHH_WINTYPE = ^tagHH_WINTYPE;
  580. {$EXTERNALSYM PHH_WINTYPE}
  581. THHWinType = tagHH_WINTYPE;
  582. const
  583. HHACT_TAB_CONTENTS = 0;
  584. {$EXTERNALSYM HHACT_TAB_CONTENTS}
  585. HHACT_TAB_INDEX = 1;
  586. {$EXTERNALSYM HHACT_TAB_INDEX}
  587. HHACT_TAB_SEARCH = 2;
  588. {$EXTERNALSYM HHACT_TAB_SEARCH}
  589. HHACT_TAB_HISTORY = 3;
  590. {$EXTERNALSYM HHACT_TAB_HISTORY}
  591. HHACT_TAB_FAVORITES = 4;
  592. {$EXTERNALSYM HHACT_TAB_FAVORITES}
  593. HHACT_EXPAND = 5;
  594. {$EXTERNALSYM HHACT_EXPAND}
  595. HHACT_CONTRACT = 6;
  596. {$EXTERNALSYM HHACT_CONTRACT}
  597. HHACT_BACK = 7;
  598. {$EXTERNALSYM HHACT_BACK}
  599. HHACT_FORWARD = 8;
  600. {$EXTERNALSYM HHACT_FORWARD}
  601. HHACT_STOP = 9;
  602. {$EXTERNALSYM HHACT_STOP}
  603. HHACT_REFRESH = 10;
  604. {$EXTERNALSYM HHACT_REFRESH}
  605. HHACT_HOME = 11;
  606. {$EXTERNALSYM HHACT_HOME}
  607. HHACT_SYNC = 12;
  608. {$EXTERNALSYM HHACT_SYNC}
  609. HHACT_OPTIONS = 13;
  610. {$EXTERNALSYM HHACT_OPTIONS}
  611. HHACT_PRINT = 14;
  612. {$EXTERNALSYM HHACT_PRINT}
  613. HHACT_HIGHLIGHT = 15;
  614. {$EXTERNALSYM HHACT_HIGHLIGHT}
  615. HHACT_CUSTOMIZE = 16;
  616. {$EXTERNALSYM HHACT_CUSTOMIZE}
  617. HHACT_JUMP1 = 17;
  618. {$EXTERNALSYM HHACT_JUMP1}
  619. HHACT_JUMP2 = 18;
  620. {$EXTERNALSYM HHACT_JUMP2}
  621. HHACT_ZOOM = 19;
  622. {$EXTERNALSYM HHACT_ZOOM}
  623. HHACT_TOC_NEXT = 20;
  624. {$EXTERNALSYM HHACT_TOC_NEXT}
  625. HHACT_TOC_PREV = 21;
  626. {$EXTERNALSYM HHACT_TOC_PREV}
  627. HHACT_NOTES = 22;
  628. {$EXTERNALSYM HHACT_NOTES}
  629. HHACT_LAST_ENUM = 23;
  630. {$EXTERNALSYM HHACT_LAST_ENUM}
  631. type
  632. PHHNTrack = ^THHNTrack;
  633. tagHHNTRACK = packed record
  634. hdr: NMHDR;
  635. pszCurUrl: PCSTR; // Multi-byte, null-terminated string
  636. idAction: Integer; // HHACT_ value
  637. phhWinType: PHHWinType; // Current window type structure
  638. end;
  639. {$EXTERNALSYM tagHHNTRACK}
  640. HHNTRACK = tagHHNTRACK;
  641. {$EXTERNALSYM HHNTRACK}
  642. THHNTrack = tagHHNTRACK;
  643. {$IFDEF HTMLHELP_DYNAMIC_LINK}
  644. type
  645. THtmlHelpA = function (hwndCaller: HWND; pszFile: PAnsiChar; uCommand: UINT;
  646. dwData: DWORD): HWND; stdcall;
  647. THtmlHelpW = function (hwndCaller: HWND; pszFile: PWideChar; uCommand: UINT;
  648. dwData: DWORD): HWND; stdcall;
  649. THtmlHelp = THtmlHelpA;
  650. var
  651. HtmlHelpA: THtmlHelpA = nil;
  652. HtmlHelpW: THtmlHelpW = nil;
  653. HtmlHelp: THtmlHelp = nil;
  654. {$ELSE}
  655. function HtmlHelpA(hwndCaller: HWND; pszFile: PAnsiChar; uCommand: UINT;
  656. {$IFDEF HTMLHELP11}
  657. dwData: DWORD): HWND; stdcall;
  658. {$ENDIF}
  659. {$IFDEF HTMLHELP12}
  660. dwData: DWORD_PTR): HWND; stdcall;
  661. {$ENDIF}
  662. {$EXTERNALSYM HtmlHelpA}
  663. function HtmlHelpW(hwndCaller: HWND; pszFile: PWideChar; uCommand: UINT;
  664. {$IFDEF HTMLHELP11}
  665. dwData: DWORD): HWND; stdcall;
  666. {$ENDIF}
  667. {$IFDEF HTMLHELP12}
  668. dwData: DWORD_PTR): HWND; stdcall;
  669. {$ENDIF}
  670. {$EXTERNALSYM HtmlHelpW}
  671. function HtmlHelp(hwndCaller: HWND; pszFile: PChar; uCommand: UINT;
  672. {$IFDEF HTMLHELP11}
  673. dwData: DWORD): HWND; stdcall;
  674. {$ENDIF}
  675. {$IFDEF HTMLHELP12}
  676. dwData: DWORD_PTR): HWND; stdcall;
  677. {$ENDIF}
  678. {$EXTERNALSYM HtmlHelp}
  679. {$ENDIF}
  680. // Use the following for GetProcAddress to load from hhctrl.ocx
  681. const
  682. ATOM_HTMLHELP_API_ANSI = LPTSTR(DWORD(WORD(14)));
  683. {$EXTERNALSYM ATOM_HTMLHELP_API_ANSI}
  684. ATOM_HTMLHELP_API_UNICODE = LPTSTR(DWORD(WORD(15)));
  685. {$EXTERNALSYM ATOM_HTMLHELP_API_UNICODE}
  686. {$IFDEF HTMLHELP12}
  687. // Global Control Properties
  688. const
  689. HH_GPROPID_SINGLETHREAD = 1; // VARIANT_BOOL: True for single thread
  690. {$EXTERNALSYM HH_GPROPID_SINGLETHREAD}
  691. HH_GPROPID_TOOLBAR_MARGIN = 2; // long: Provides a left/right margin around the toolbar.
  692. {$EXTERNALSYM HH_GPROPID_TOOLBAR_MARGIN}
  693. HH_GPROPID_UI_LANGUAGE = 3; // long: LangId of the UI.
  694. {$EXTERNALSYM HH_GPROPID_UI_LANGUAGE}
  695. HH_GPROPID_CURRENT_SUBSET = 4; // BSTR: Current subset.
  696. {$EXTERNALSYM HH_GPROPID_CURRENT_SUBSET}
  697. HH_GPROPID_CONTENT_LANGUAGE = 5; // long: LandId for desired content.
  698. {$EXTERNALSYM HH_GPROPID_CONTENT_LANGUAGE}
  699. type
  700. HH_GPROPID = HH_GPROPID_SINGLETHREAD..HH_GPROPID_CONTENT_LANGUAGE;
  701. {$EXTERNALSYM HH_GPROPID}
  702. THHGPropID = HH_GPROPID;
  703. // Global Property structure
  704. PHHGlobalProperty = ^THHGlobalProperty;
  705. tagHH_GLOBAL_PROPERTY = record
  706. id: THHGPropID;
  707. Dummy: Integer; // JEDI: Added to enforce 8-byte packing
  708. var_: OleVariant;
  709. end;
  710. HH_GLOBAL_PROPERTY = tagHH_GLOBAL_PROPERTY;
  711. THHGlobalProperty = tagHH_GLOBAL_PROPERTY;
  712. {$ENDIF}
  713. {$IFDEF HTMLHELP_DYNAMIC_LINK}
  714. function HtmlHelpLoaded: Boolean;
  715. {$IFDEF HTMLHELP_DYNAMIC_LINK_EXPLICIT}
  716. function LoadHtmlHelp: Boolean;
  717. function UnLoadHtmlHelp: Boolean;
  718. {$ENDIF}
  719. var
  720. HtmlHelpIsAvail : boolean;
  721. {$ENDIF}
  722. implementation
  723. {$IFDEF HTMLHELP_DYNAMIC_LINK}
  724. uses
  725. MSysUtils;
  726. var
  727. HtmlHelpLib: THandle = 0;
  728. function GetOCXPath(var Path: string): Boolean;
  729. const
  730. HHPathRegKey = 'CLSID\{adb880a6-d8ff-11cf-9377-00aa003b7a11}\InprocServer32';
  731. var
  732. rgHandle : HKEY;
  733. lpType, cbData : dword;
  734. pBuffer : array[0..MAX_PATH]of char;
  735. begin
  736. Result := false;
  737. lpType := REG_NONE;
  738. // "Autorun"?
  739. if(RegOpenKeyEx(HKEY_CLASSES_ROOT,HHPathRegKey,0,KEY_QUERY_VALUE,
  740. rgHandle) = ERROR_SUCCESS) then
  741. try
  742. lpType := REG_NONE;
  743. cbData := 0;
  744. if(RegQueryValueEx(rgHandle,nil,nil,@lpType,nil,@cbData) =
  745. ERROR_SUCCESS) and
  746. (lpType = REG_SZ) and (cbData > 1) then
  747. if(RegQueryValueEx(rgHandle,nil,nil,@lpType,@pBuffer,@cbData) =
  748. ERROR_SUCCESS) then
  749. begin
  750. Path := string(pBuffer);
  751. Result := (Path <> '') and (fileexists(Path));
  752. end;
  753. finally
  754. RegCloseKey(rgHandle);
  755. end;
  756. end;
  757. function HtmlHelpLoaded: Boolean;
  758. begin
  759. HtmlHelpIsAvail := (HtmlHelpLib <> 0); Result := HtmlHelpIsAvail;
  760. end;
  761. function UnLoadHtmlHelp: Boolean;
  762. begin
  763. Result := True;
  764. if HtmlHelpLoaded then
  765. begin
  766. if Assigned(HtmlHelp) then HtmlHelp(0, nil, HH_CLOSE_ALL, 0);
  767. Result := FreeLibrary(HtmlHelpLib);
  768. HtmlHelpLib := 0;
  769. @HtmlHelpA := nil;
  770. @HtmlHelpW := nil;
  771. @HtmlHelp := nil;
  772. end;
  773. end;
  774. function LoadHtmlHelp: Boolean;
  775. const
  776. ProcNameA = 'HtmlHelpA';
  777. ProcNameW = 'HtmlHelpW';
  778. ProcName = ProcNameA;
  779. var
  780. HHOCXPath: string;
  781. begin
  782. Result := HtmlHelpLoaded;
  783. if (not Result) and GetOCXPath(HHOCXPath) then
  784. begin
  785. HtmlHelpLib := LoadLibrary(PChar(HHOCXPath));
  786. if HtmlHelpLoaded then
  787. begin
  788. @HtmlHelpA := GetProcAddress(HtmlHelpLib, ProcNameA);
  789. @HtmlHelpW := GetProcAddress(HtmlHelpLib, ProcNameW);
  790. @HtmlHelp := GetProcAddress(HtmlHelpLib, ProcName);
  791. Result := Assigned(HtmlHelpA) and Assigned(HtmlHelpW);
  792. if not Result then UnLoadHtmlHelp;
  793. end;
  794. end;
  795. end;
  796. {$ELSE}
  797. const
  798. hhctrl = 'hhctrl.ocx';
  799. function HtmlHelpA; external hhctrl Name 'HtmlHelpA';
  800. {$EXTERNALSYM HtmlHelpA}
  801. function HtmlHelpW; external hhctrl Name 'HtmlHelpW';
  802. {$EXTERNALSYM HtmlHelpW}
  803. function HtmlHelp; external hhctrl Name 'HtmlHelpA';
  804. {$EXTERNALSYM HtmlHelp}
  805. {$ENDIF}
  806. {$IFDEF HTMLHELP_DYNAMIC_LINK}
  807. initialization
  808. {$IFNDEF HTMLHELP_DYNAMIC_LINK_EXPLICIT}
  809. LoadHtmlHelp;
  810. {$ENDIF}
  811. finalization
  812. UnLoadHtmlHelp;
  813. {$ENDIF}
  814. end.