PageRenderTime 40ms CodeModel.GetById 13ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 1ms

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