📄 delphihtmlhelp1.pas
字号:
pszCatName: LPCSTR; // the name of the category, if any, the InfoType is a member of.
pszInfoTypeName: LPCSTR; // the name of the info type to add to the filter
end;
HH_SET_INFOTYPE = tagHH_SET_INFOTYPE;
PHH_SET_INFOTYPE = ^tagHH_SET_INFOTYPE;
HH_INFOTYPE = DWORD;
PHH_INFOTYPE = ^HH_INFOTYPE;
const
HHWIN_NAVTAB_TOP = 0;
HHWIN_NAVTAB_LEFT = 1;
HHWIN_NAVTAB_BOTTOM = 2;
HH_MAX_TABS = 19; // maximum number of tabs
HH_TAB_CONTENTS = 0;
HH_TAB_INDEX = 1;
HH_TAB_SEARCH = 2;
HH_TAB_FAVORITES = 3;
HH_TAB_HISTORY = 4;
HH_TAB_AUTHOR = 5;
HH_TAB_CUSTOM_FIRST = 11;
HH_TAB_CUSTOM_LAST = HH_MAX_TABS;
HH_MAX_TABS_CUSTOM = HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1;
// HH_DISPLAY_SEARCH Command Related Structures and Constants
HH_FTS_DEFAULT_PROXIMITY = -1;
type
tagHH_FTS_QUERY = record
cbStruct: integer; // Sizeof structure in bytes.
fUniCodeStrings: BOOL; // TRUE if all strings are unicode.
pszSearchQuery: LPCTSTR; // String containing the search query.
iProximity: LongInt; // Word proximity.
fStemmedSearch: BOOL; // TRUE for StemmedSearch only.
fTitleOnly: BOOL; // TRUE for Title search only.
fExecute: BOOL; // TRUE to initiate the search.
pszWindow: LPCTSTR; // Window to display in
end;
HH_FTS_QUERY = tagHH_FTS_QUERY;
// HH_WINTYPE Structure
tagHH_WINTYPE = record
cbStruct: integer; // IN: size of this structure including all Information Types
fUniCodeStrings: BOOL; // IN/OUT: TRUE if all strings are in UNICODE
pszType: LPCTSTR; // IN/OUT: Name of a type of window
fsValidMembers: DWORD; // IN: Bit flag of valid members (HHWIN_PARAM_)
fsWinProperties: DWORD; // IN/OUT: Properties/attributes of the window (HHWIN_)
pszCaption: LPCTSTR; // IN/OUT: Window title
dwStyles: DWORD; // IN/OUT: Window styles
dwExStyles: DWORD; // IN/OUT: Extended Window styles
rcWindowPos: TRECT; // IN: Starting position, OUT: current position
nShowState: integer; // IN: show state (e.g., SW_SHOW)
hwndHelp: HWND; // OUT: window handle
hwndCaller: HWND; // OUT: who called this window
paInfoTypes: ^HH_INFOTYPE; // IN: Pointer to an array of Information Types
// The following members are only valid if HHWIN_PROP_TRI_PANE is set
hwndToolBar: HWND; // OUT: toolbar window in tri-pane window
hwndNavigation: HWND; // OUT: navigation window in tri-pane window
hwndHTML: HWND; // OUT: window displaying HTML in tri-pane window
iNavWidth: integer; // IN/OUT: width of navigation window
rcHTML: TRECT; // OUT: HTML window coordinates
pszToc: LPCTSTR; // IN: Location of the table of contents file
pszIndex: LPCTSTR; // IN: Location of the index file
pszFile: LPCTSTR; // IN: Default location of the html file
pszHome: LPCTSTR; // IN/OUT: html file to display when Home button is clicked
fsToolBarFlags: DWORD; // IN: flags controling the appearance of the toolbar
fNotExpanded: BOOL; // IN: TRUE/FALSE to contract or expand, OUT: current state
curNavType: integer; // IN/OUT: UI to display in the navigational pane
tabpos: integer; // IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
idNotify: integer; // IN: ID to use for WM_NOTIFY messages
tabOrder: array[0..HH_MAX_TABS] of BYTE; // IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
cHistory: integer; // IN/OUT: number of history items to keep (default is 30)
pszJump1: LPCTSTR; // Text for HHWIN_BUTTON_JUMP1
pszJump2: LPCTSTR; // Text for HHWIN_BUTTON_JUMP2
pszUrlJump1: LPCTSTR; // URL for HHWIN_BUTTON_JUMP1
pszUrlJump2: LPCTSTR; // URL for HHWIN_BUTTON_JUMP2
rcMinSize: TRECT; // Minimum size for window (ignored in version 1)
cbInfoTypes: integer; // size of paInfoTypes:
pszCustomTabs: LPCTSTR; // multiple zero-terminated strings
end;
HH_WINTYPE = tagHH_WINTYPE;
PHH_WINTYPE = ^tagHH_WINTYPE;
THHACT = (
HHACT_TAB_CONTENTS,
HHACT_TAB_INDEX,
HHACT_TAB_SEARCH,
HHACT_TAB_HISTORY,
HHACT_TAB_FAVORITES,
HHACT_EXPAND,
HHACT_CONTRACT,
HHACT_BACK,
HHACT_FORWARD,
HHACT_STOP,
HHACT_REFRESH,
HHACT_HOME,
HHACT_SYNC,
HHACT_OPTIONS,
HHACT_PRINT,
HHACT_HIGHLIGHT,
HHACT_CUSTOMIZE,
HHACT_JUMP1,
HHACT_JUMP2,
HHACT_ZOOM,
HHACT_TOC_NEXT,
HHACT_TOC_PREV,
HHACT_NOTES,
HHACT_LAST_ENUM
);
tagHHNTRACK = record
hdr: NMHDR;
pszCurUrl: PChar; // Multi-byte, null-terminated string
idAction: integer; // HHACT_ value
phhWinType: ^HH_WINTYPE; // Current window type structure
end;
HHNTRACK = tagHHNTRACK;
///////////////////////////////////////////////////////////////////////////////
//
// Global Control Properties.
//
// tagHH_GPROPID = (
const
HH_GPROPID_SINGLETHREAD = 1; // VARIANT_BOOL: True for single thread
HH_GPROPID_TOOLBAR_MARGIN = 2; // long: Provides a left/right margin around the toolbar.
HH_GPROPID_UI_LANGUAGE = 3; // long: LangId of the UI.
HH_GPROPID_CURRENT_SUBSET = 4; // BSTR: Current subset.
HH_GPROPID_CONTENT_LANGUAGE = 5; // long: LandId for desired content.
// );
// HH_GPROPID = tagHH_GPROPID;
type
HH_GPROPID = integer;
///////////////////////////////////////////////////////////////////////////////
//
// Global Property structure
//
tagHH_GLOBAL_PROPERTY = record
id: HH_GPROPID;
vari: Variant;
end;
HH_GLOBAL_PROPERTY = tagHH_GLOBAL_PROPERTY;
DWORD_PTR = ^DWORD;
(******************************************************************************)
function HtmlHelp_(strFile: string): HWND;
function HtmlHelp(hwndCaller: HWND; strFile: string; uCommand: UINT; dwData: DWORD_PTR): HWND;
procedure CloseHtmlHelpSystem;
(******************************************************************************)
implementation
uses
SysUtils;
var
HHControlInstance: THandle = 0;
const
dwCookie: DWORD = 0;
var
HtmlHelpA: function(hwndCaller: HWND; pszFile: PChar; uCommand: UINT; dwData: DWORD_PTR): HWND; stdcall;
(* function implementatoins *)
function HtmlHelp_(strFile: string): HWND;
begin
Result := HtmlHelp(Application.handle, strFile, HH_DISPLAY_TOPIC, nil);
end;
function HtmlHelp(hwndCaller: HWND; strFile: string; uCommand: UINT; dwData: DWORD_PTR): HWND;
var
OcxFileName: string;
p: PChar;
begin
if HHControlInstance = 0 then
begin
OcxFileName := StringOfChar(' ', 256);
p := PChar(OcxFilename);
GetSystemDirectory(p, 255);
StrCat(p, '\HHCTRL.OCX');
HHControlInstance := LoadLibrary(P);
if HHControlInstance = 0 then
raise exception.Create('HHCtrl.OCX 没有安装!'#13' 不能使用HTML帮助!');
@HtmlHelpA := GetProcAddress(HHControlInstance, 'HtmlHelpA');
if @HtmlHelpA = nil then
raise exception.Create('Function HTMLHELP cannot loaded!');
HtmlHelpA(0, nil, HH_INITIALIZE, (@dwCookie));
end;
result := HtmlHelpA(hwndCaller, PChar(strFile), uCommand, dwData);
end;
procedure CloseHtmlHelpSystem;
begin
if HHControlInstance <> 0 then
begin
HtmlHelpA(0, nil, HH_UNINITIALIZE, DWORD_PTR(dwCookie));
FreeLibrary(HHControlInstance);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -