Skip to content

Commit bd40a66

Browse files
committed
Fix HTML help code to work with 32 & 64 bit builds
Copies THHAKLink record definition from UHTMLHelp unit into UHTMLHelpMgr unit. Modified THTMLHelpMgr in UHTMLHelpMgr to be compatible with both 32 and 64 bit calls to the HTML Help API. Removed UHTMLHelp unit from project. Earlier compilers didn't have a translation of the HTML Help C headers, so a custom written one was used. Delphi has had such a translation in the Windows unit for quite some time now, so this has been used in place of UHTMLHelp. The decision was made to change because the Windows unit contains 32/64 bit compatible function prototypes whilst the custom code only supported 32 bit prototypes.
1 parent ac3c3e5 commit bd40a66

File tree

4 files changed

+21
-246
lines changed

4 files changed

+21
-246
lines changed

Src/CodeSnip.Caboli.dpr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ uses
245245
UHiddenRichEdit in 'UHiddenRichEdit.pas',
246246
UHistory in 'UHistory.pas',
247247
UHistoryMenus in 'UHistoryMenus.pas',
248-
UHTMLHelp in 'UHTMLHelp.pas',
249248
UHTMLHelpMgr in 'UHTMLHelpMgr.pas',
250249
UHTTPProtocol in 'UHTTPProtocol.pas',
251250
UIniDataLoader in 'UIniDataLoader.pas',

Src/CodeSnip.Caboli.dproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@
490490
<DCCReference Include="UHiddenRichEdit.pas"/>
491491
<DCCReference Include="UHistory.pas"/>
492492
<DCCReference Include="UHistoryMenus.pas"/>
493-
<DCCReference Include="UHTMLHelp.pas"/>
494493
<DCCReference Include="UHTMLHelpMgr.pas"/>
495494
<DCCReference Include="UHTTPProtocol.pas"/>
496495
<DCCReference Include="UIniDataLoader.pas"/>

Src/UHTMLHelp.pas

Lines changed: 0 additions & 240 deletions
This file was deleted.

Src/UHTMLHelpMgr.pas

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ implementation
2424
// Delphi
2525
Windows,
2626
// Project
27-
UAppInfo, UEncodings, UHTMLHelp, UHelpMgr;
27+
UAppInfo, UEncodings, UHelpMgr;
2828

2929

3030
type
@@ -37,7 +37,7 @@ THTMLHelpMgr = class(TInterfacedObject,
3737
)
3838
strict private
3939
procedure DoAppHelp(const Command: LongWord; const HelpPage: string;
40-
const Data: LongWord);
40+
const Data: NativeUInt);
4141
{Calls HtmlHelp API with specified command and parameters.
4242
@param Command [in] Command to send to HTML Help.
4343
@param HelpPage [in] Name of HTML file containing required help page
@@ -54,10 +54,27 @@ THTMLHelpMgr = class(TInterfacedObject,
5454
}
5555
end;
5656

57+
{
58+
THHAKLink:
59+
Structure used to specify one or more ALink names or KLink keywords to be
60+
searched for.
61+
}
62+
THHAKLink = packed record
63+
cbStruct: Integer; // sizeof this structure
64+
fReserved: BOOL; // must be FALSE (really!)
65+
pszKeywords: LPCTSTR; // semi-colon separated keywords
66+
pszUrl: LPCTSTR; // URL to jump to if no keywords found (may be nil)
67+
pszMsgText: LPCTSTR; // MessageBox text on failure (used if pszUrl nil)
68+
pszMsgTitle: LPCTSTR; // Title of any failure MessageBox
69+
pszWindow: LPCTSTR; // Window to display pszURL in
70+
fIndexOnFail: BOOL; // Displays index if keyword lookup fails.
71+
end;
72+
73+
5774
{ THTMLHelpMgr }
5875

5976
procedure THTMLHelpMgr.DoAppHelp(const Command: LongWord;
60-
const HelpPage: string; const Data: LongWord);
77+
const HelpPage: string; const Data: NativeUInt);
6178
{Calls HtmlHelp API with specified command and parameters.
6279
@param Command [in] Command to send to HTML Help.
6380
@param HelpPage [in] Name of HTML file containing required help page within
@@ -98,7 +115,7 @@ procedure THTMLHelpMgr.ShowHelp(const AKeyword: string);
98115
ALink.pszKeywords := Pointer(StringToASCIIString(AKeyword));
99116
ALink.fIndexOnFail := True;
100117
// Display help
101-
DoAppHelp(HH_ALINK_LOOKUP, '', LongWord(@ALink));
118+
DoAppHelp(HH_ALINK_LOOKUP, '', DWORD_PTR(@ALink));
102119
end;
103120

104121
initialization

0 commit comments

Comments
 (0)