home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d3456 / EHS.ZIP / setup.exe / {app} / ehshhapi.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-03-25  |  11.2 KB  |  311 lines

  1. { pascal translation from htmlhelp.h
  2.  
  3.   Delphi 3/4/5/6 Implementation of the HTML HELP api.
  4.  
  5.   ⌐ 2000-2001 EC Software. All rights reserved.
  6.  
  7.   This product and it's source code is protected by copyright laws and
  8.   international copyright treaties, as well as other intellectual property
  9.   laws and treaties. The product is licensed, not sold.
  10.  
  11.   The source code and sample programs in this package or parts hereof
  12.   as well as the documentation shall not be copied, modified or redistributed
  13.   without permission, explicit or implied, of the author.
  14.  
  15.  
  16.   EMail: info@ec-software.com
  17.   Internet: http://www.ec-software.com
  18.  
  19.   Disclaimer of Warranty
  20.   ----------------------
  21.  
  22.   THIS SOFTWARE AND THE ACCOMPANYING FILES ARE PROVIDED "AS IS" AND
  23.   WITHOUT WARRANTIES OF ANY KIND WHETHER EXPRESSED OR IMPLIED.
  24.  
  25.   In no event shall the author be held liable for any damages whatsoever,
  26.   including without limitation, damages for loss of business profits,
  27.   business interruption, loss of business information, or any other loss
  28.   arising from the use or inability to use the software. }
  29.  
  30. unit ehshhapi;
  31.  
  32. interface
  33.  
  34. uses
  35.   Windows, Messages, SysUtils, Classes, Graphics {for TColor};
  36.  
  37. const
  38.   HH_DISPLAY_TOPIC         = $0000;
  39.   HH_HELP_FINDER           = $0000;  // WinHelp equivalent
  40.   HH_DISPLAY_TOC           = $0001;  // not currently implemented
  41.   HH_DISPLAY_INDEX         = $0002;  // not currently implemented
  42.   HH_DISPLAY_SEARCH        = $0003;  // not currently implemented
  43.   HH_SET_WIN_TYPE          = $0004;
  44.   HH_GET_WIN_TYPE          = $0005;
  45.   HH_GET_WIN_HANDLE        = $0006;
  46.   HH_ENUM_INFO_TYPE        = $0007;  // Get Info type name, call repeatedly to enumerate, -1 at end
  47.   HH_SET_INFO_TYPE         = $0008;  // Add Info type to filter.
  48.   HH_SYNC                  = $0009;
  49.   HH_RESERVED1             = $000A;
  50.   HH_RESERVED2             = $000B;
  51.   HH_RESERVED3             = $000C;
  52.   HH_KEYWORD_LOOKUP        = $000D;
  53.   HH_DISPLAY_TEXT_POPUP    = $000E;  // display string resource id or text in a popup window
  54.   HH_HELP_CONTEXT          = $000F;  // display mapped numeric value in dwData
  55.   HH_TP_HELP_CONTEXTMENU   = $0010;  // text popup help, same as WinHelp HELP_CONTEXTMENU
  56.   HH_TP_HELP_WM_HELP       = $0011;  // text popup help, same as WinHelp HELP_WM_HELP
  57.   HH_CLOSE_ALL             = $0012;  // close all windows opened directly or indirectly by the caller
  58.   HH_ALINK_LOOKUP          = $0013;  // ALink version of HH_KEYWORD_LOOKUP
  59.   HH_GET_LAST_ERROR        = $0014;  // not currently implemented // See HHERROR.h
  60.   HH_ENUM_CATEGORY         = $0015;  // Get category name, call repeatedly to enumerate, -1 at end
  61.   HH_ENUM_CATEGORY_IT      = $0016;  // Get category info type members, call repeatedly to enumerate, -1 at end
  62.   HH_RESET_IT_FILTER       = $0017;  // Clear the info type filter of all info types.
  63.   HH_SET_INCLUSIVE_FILTER  = $0018;  // set inclusive filtering method for untyped topics to be included in display
  64.   HH_SET_EXCLUSIVE_FILTER  = $0019;  // set exclusive filtering method for untyped topics to be excluded from display
  65.   HH_INITIALIZE            = $001C;  // Initializes the help system.
  66.   HH_UNINITIALIZE          = $001D;  // Uninitializes the help system.
  67.   HH_PRETRANSLATEMESSAGE   = $00fd;  // Pumps messages. (NULL, NULL, MSG*).
  68.   HH_SET_GLOBAL_PROPERTY   = $00fc;  // Set a global property. (NULL, NULL, HH_GPROP)
  69.  
  70. type
  71.   THHWIN_PROP = (
  72.          HHWIN_PROP_TAB_AUTOHIDESHOW,// Automatically hide/show tri-pane window
  73.          HHWIN_PROP_ONTOP,         // Top-most window
  74.          HHWIN_PROP_NOTITLEBAR,    // no title bar
  75.          HHWIN_PROP_NODEF_STYLES,  // no default window styles (only HH_WINTYPE.dwStyles)
  76.          HHWIN_PROP_NODEF_EXSTYLES,// no default extended window styles (only HH_WINTYPE.dwExStyles)
  77.          HHWIN_PROP_TRI_PANE,      // use a tri-pane window
  78.          HHWIN_PROP_NOTB_TEXT,     // no text on toolbar buttons
  79.          HHWIN_PROP_POST_QUIT,     // post WM_QUIT message when window closes
  80.          HHWIN_PROP_AUTO_SYNC,     // automatically ssync contents and index
  81.          HHWIN_PROP_TRACKING,      // send tracking notification messages
  82.          HHWIN_PROP_TAB_SEARCH,    // include search tab in navigation pane
  83.          HHWIN_PROP_TAB_HISTORY,   // include history tab in navigation pane
  84.          HHWIN_PROP_TAB_FAVORITES, // include favorites tab in navigation pane
  85.          HHWIN_PROP_CHANGE_TITLE,  // Put current HTML title in title bar
  86.          HHWIN_PROP_NAV_ONLY_WIN,  // Only display the navigation window
  87.          HHWIN_PROP_NO_TOOLBAR,    // Don't display a toolbar
  88.          HHWIN_PROP_MENU,          // Menu
  89.          HHWIN_PROP_TAB_ADVSEARCH, // Advanced FTS UI.
  90.          HHWIN_PROP_USER_POS,      // After initial creation, user controls window size/position
  91.          HHWIN_PROP_TAB_CUSTOM1,   // Use custom tab #1
  92.          HHWIN_PROP_TAB_CUSTOM2,   // Use custom tab #2
  93.          HHWIN_PROP_TAB_CUSTOM3,   // Use custom tab #3
  94.          HHWIN_PROP_TAB_CUSTOM4,   // Use custom tab #4
  95.          HHWIN_PROP_TAB_CUSTOM5,   // Use custom tab #5
  96.          HHWIN_PROP_TAB_CUSTOM6,   // Use custom tab #6
  97.          HHWIN_PROP_TAB_CUSTOM7,   // Use custom tab #7
  98.          HHWIN_PROP_TAB_CUSTOM8,   // Use custom tab #8
  99.          HHWIN_PROP_TAB_CUSTOM9,   // Use custom tab #9
  100.          HHWIN_TB_MARGIN           // the window type has a margin
  101.          );
  102.   THHWIN_PROPS = set of THHWIN_PROP;
  103.  
  104.   THHWIN_PARAM = (
  105.          HHWIN_PARAM_NOTUSED,
  106.          HHWIN_PARAM_PROPERTIES,   // valid fsWinProperties
  107.          HHWIN_PARAM_STYLES,       // valid dwStyles
  108.          HHWIN_PARAM_EXSTYLES,       // valid dwExStyles
  109.          HHWIN_PARAM_RECT,       // valid rcWindowPos
  110.          HHWIN_PARAM_NAV_WIDTH,       // valid iNavWidth
  111.          HHWIN_PARAM_SHOWSTATE,       // valid nShowState
  112.          HHWIN_PARAM_INFOTYPES,       // valid ainfoTypes
  113.          HHWIN_PARAM_TB_FLAGS,       // valid fsToolBarFlags
  114.          HHWIN_PARAM_EXPANSION,       // valid fNotExpanded
  115.          HHWIN_PARAM_TABPOS,       // valid tabpos
  116.          HHWIN_PARAM_TABORDER,       // valid taborder
  117.          HHWIN_PARAM_HISTORY_COUNT,// valid cHistory
  118.          HHWIN_PARAM_CUR_TAB       // valid curNavType
  119.          );
  120.   THHWIN_PARAMS = set of THHWIN_PARAM;
  121.  
  122.   THHWIN_BUTTON = (
  123.          HHWIN_BUTTON_EXPAND,     // Expand/contract button
  124.          HHWIN_BUTTON_BACK,       // Back button
  125.          HHWIN_BUTTON_FORWARD,    // Forward button
  126.          HHWIN_BUTTON_STOP,       // Stop button
  127.          HHWIN_BUTTON_REFRESH,    // Refresh button
  128.          HHWIN_BUTTON_HOME,       // Home button
  129.          HHWIN_BUTTON_BROWSE_FWD, // not implemented
  130.          HHWIN_BUTTON_BROWSE_BCK, // not implemented
  131.          HHWIN_BUTTON_NOTES,      // not implemented
  132.          HHWIN_BUTTON_CONTENTS,   // not implemented
  133.          HHWIN_BUTTON_SYNC,       // Sync button
  134.          HHWIN_BUTTON_OPTIONS,    // Options button
  135.          HHWIN_BUTTON_PRINT,      // Print button
  136.          HHWIN_BUTTON_INDEX,      // not implemented
  137.          HHWIN_BUTTON_SEARCH,     // not implemented
  138.          HHWIN_BUTTON_HISTORY,    // not implemented
  139.          HHWIN_BUTTON_FAVORITES,  // not implemented
  140.          HHWIN_BUTTON_JUMP1,
  141.          HHWIN_BUTTON_JUMP2,
  142.          HHWIN_BUTTON_ZOOM,
  143.          HHWIN_BUTTON_TOC_NEXT,
  144.          HHWIN_BUTTON_TOC_PREV
  145.          );
  146.   THHWIN_BUTTONS = set of THHWIN_BUTTON;
  147.  
  148. const
  149.   HHWIN_DEF_BUTTONS = [HHWIN_BUTTON_EXPAND,
  150.                        HHWIN_BUTTON_BACK,
  151.                        HHWIN_BUTTON_OPTIONS,
  152.                        HHWIN_BUTTON_PRINT];
  153.  
  154. // Button IDs
  155.  
  156.   IDTB_EXPAND            = 200;
  157.   IDTB_CONTRACT          = 201;
  158.   IDTB_STOP              = 202;
  159.   IDTB_REFRESH           = 203;
  160.   IDTB_BACK              = 204;
  161.   IDTB_HOME              = 205;
  162.   IDTB_SYNC              = 206;
  163.   IDTB_PRINT             = 207;
  164.   IDTB_OPTIONS           = 208;
  165.   IDTB_FORWARD           = 209;
  166.   IDTB_NOTES             = 210; // not implemented
  167.   IDTB_BROWSE_FWD        = 211;
  168.   IDTB_BROWSE_BACK       = 212;
  169.   IDTB_CONTENTS          = 213; // not implemented
  170.   IDTB_INDEX             = 214; // not implemented
  171.   IDTB_SEARCH            = 215; // not implemented
  172.   IDTB_HISTORY           = 216; // not implemented
  173.   IDTB_FAVORITES         = 217; // not implemented
  174.   IDTB_JUMP1             = 218;
  175.   IDTB_JUMP2             = 219;
  176.   IDTB_CUSTOMIZE         = 221;
  177.   IDTB_ZOOM              = 222;
  178.   IDTB_TOC_NEXT          = 223;
  179.   IDTB_TOC_PREV          = 224;
  180.  
  181. // Notification codes
  182.  
  183.   HHN_FIRST         = -860;
  184.   HHN_LAST          = -879;
  185.   HHN_NAVCOMPLETE   = HHN_FIRST;
  186.   HHN_TRACK         = HHN_FIRST - 1;
  187.   HHN_WINDOW_CREATE = HHN_FIRST - 2;
  188.  
  189.  
  190. type
  191.    PHH_AKLINK = ^THH_AKLINK;
  192.    THH_AKLINK = record
  193.      cbStruct: integer;
  194.      fReserved: boolean;
  195.      pszKeywords: pchar;
  196.      pszUrl: pchar;
  197.      pszMsgText: pchar;
  198.      pszMsgTitle: pchar;
  199.      pszMsgWindow: pchar;
  200.      fIndexOnFail: boolean;
  201.    end;
  202.  
  203.    PHH_POPUP = ^THH_POPUP;
  204.    THH_POPUP = record
  205.      cbStruct: integer;
  206.      hinst: THandle;
  207.      idString: cardinal;
  208.      pszText: pchar;
  209.      pt: TPoint;
  210.      clrForeground: TColor;
  211.      clrBackground: TColor;
  212.      rcMargins: TRect;
  213.      pszFont: pchar;
  214.    end;
  215.  
  216.    PHH_FTS_QUERY = ^THH_FTS_QUERY;
  217.    THH_FTS_QUERY = record
  218.      cbStruct: integer;
  219.      fUniCodeStrings: boolean;
  220.      pszSearchQuery: pchar;
  221.      iProximity: longint;
  222.      fStemmedSearch: boolean;
  223.      fTitleOnly: boolean;
  224.      fExecute: boolean;
  225.      pszWindow: pchar;
  226.    end;
  227.  
  228.    PHH_WINTYPE = ^THH_WINTYPE;
  229.    THH_WINTYPE = record
  230.      cbStruct: integer;
  231.      fUniCodeStrings: boolean;
  232.      pszType: pchar;
  233.      fsValidMembers: THHWIN_PARAMS;
  234.      fsWinProperties: THHWIN_PROPS;
  235.      pszCaption: pchar;
  236.      dwStyles: dword;
  237.      dwExStyles: dword;
  238.      rcWindowPos: TRect;
  239.      nShowState: integer;
  240.      hwndHelp: HWND;
  241.      hwndCaller: HWND;
  242.      hwndToolBar: HWND;
  243.      hwndNavigation: HWND;
  244.      hwndHTML: HWND;
  245.      iNavWidth: integer;
  246.      rcHTML: TRect;
  247.      pszToc: pchar;
  248.      pszIndex: pchar;
  249.      pszFile: pchar;
  250.      pszHome: pchar;
  251.      fsToolBarFlags: THHWIN_BUTTONS;
  252.      fNotExpanded: boolean;
  253.      curNavType: integer;
  254.      idNotify: integer;
  255.      pszJump1: pchar;
  256.      pszJump2: pchar;
  257.      pszUrlJump1: pchar;
  258.      pszUrlJump2: pchar;
  259.    end;
  260.  
  261.    PHHN_NOTIFY = ^THHN_NOTIFY;
  262.    THHN_NOTIFY = record
  263.      hdr: TNMHDR;
  264.      pszUrl: pchar;
  265.    end;
  266.  
  267.    PHHNTRACK = ^THHNTRACK;
  268.    THHNTRACK = record
  269.      hdr: TNMHDR;
  270.      pszCurUrl: pchar;
  271.      idAction: integer;
  272.      phhWinType: PHH_WINTYPE;
  273.    end;
  274.  
  275.    PHH_LAST_ERROR = ^THH_LAST_ERROR;
  276.    THH_LAST_ERROR = record
  277.      cbStruct: integer;
  278.      hr: HRESULT;
  279.      description: PWideChar;
  280.    end;
  281.  
  282.    THtmlHelpA = function(hwndCaller: THandle; pszFile: pchar; uCommand: cardinal; dwData: longint): THandle; stdCall;
  283.  
  284. var
  285.    HtmlHelpA: THtmlHelpA;
  286.    HHCTRL: THandle;
  287.  
  288. function LoadHH: boolean;
  289.  
  290. implementation
  291.  
  292. function LoadHH: boolean;
  293. begin
  294.   if HHCTRL = 0 then
  295.   try
  296.     HtmlHelpA := nil;
  297.     HHCTRL := LoadLibrary('HHCTRL.OCX');
  298.     if (HHCTRL <> 0) then HtmlHelpA := GetProcAddress(HHCTRL, 'HtmlHelpA');
  299.   except
  300. {no error here, HTML HELP is not or not properly installed}
  301.   end;
  302.   result := HHCTRL <> 0;
  303. end;
  304.  
  305. initialization
  306.   HHCTRL := 0;
  307.  
  308. finalization
  309.   if (HHCTRL <> 0) then FreeLibrary(HHCTRL);
  310. end.
  311.