无需打开另一个窗口即可跳转至 CHM 帮助文件中的主题
我在安装程序中包含了一个精简的 CHM 帮助,并且我希望安装程序向导的每个页面上的帮助按钮都可以调用不同的帮助页面。如果我通过执行命令 hh.exe -mapid 1234 MyAppCutDownHelp.chm
从一个安装程序向导页面打开帮助窗口,它工作正常,但如果我稍后从另一个向导页面使用 执行相同的操作>hh.exe -mapid 5678 MyAppCutDownHelp.chm
我明白了该主题,但是 HH.EXE 的另一个实例启动了,然后我有两个帮助窗口,一个带有主题1234 和一个主题 5678。
我希望第一次调用 HH.exe 来打开 CHM 帮助窗口,从那时起,后续的帮助主题将显示在安装程序的正常帮助窗口中。
我不相信我可以从 Inno Setup 脚本 Pascal 访问与通常从 Delphi 访问相同的 HTML 帮助 API。
我目前正在启动帮助引擎
ShellExecAsOriginalUser ('open', ExpandConstant ('{tmp}\MyAppCutDownHelp.chm'), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) ;
,但我想它只会调用 HH.exe。
更新这是我根据@Robert的回答所做的最新尝试:
; -- Help Test.iss --
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
[Code]
const
HH_DISPLAY_TOPIC = 0;
HH_DISPLAY_TOC =1;
HH_DISPLAY_INDEX =2;
HH_HELP_CONTEXT = 15;
function HtmlHelpA (hWndCaller: HWND; pszFile: PAnsiChar; uCommand: UINT; dwData: DWORD): HWnd;
external '[email protected] stdcall';
function HtmlHelp(hWndCaller: HWND; pszFile: String; uCommand: UINT; dwData: DWORD): HWnd;
begin
try
result := HtmlHelpA(hWndCaller,pszFile,uCommand,dwData);
except
MsgBox('Unable To Display Help file.', mbError, MB_OK);
end;
end;
function InitializeSetup : Boolean;
begin
HtmlHelp(0,'MyProg.chm',HH_DISPLAY_TOC,0);
result := true;
end;
I'm including a cut-down CHM help with an installer and I want the help button on each page of the installer wizard to call up a different help page. If I open the help window from one installer wizard page by executing the command hh.exe -mapid 1234 MyAppCutDownHelp.chm
it works fine, but if I do the same thing later from another wizard page with hh.exe -mapid 5678 MyAppCutDownHelp.chm
I get that topic OK, but another instance of HH.EXE is started and I then have two help windows, one with topic 1234 and one with topic 5678.
I would like the first invocation of HH.exe to open the CHM help window, and from then on to have subsequent help topics display within the sane help window from the installer.
I don't believe I have access to the same HTML help API from the Inno Setup scripting Pascal that I would normally have from Delphi.
I am at present starting the help engine with
ShellExecAsOriginalUser ('open', ExpandConstant ('{tmp}\MyAppCutDownHelp.chm'), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode) ;
but I imagine that just calls HH.exe.
Update Here is my latest attempt based on @Robert's answer:
; -- Help Test.iss --
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
[Code]
const
HH_DISPLAY_TOPIC = 0;
HH_DISPLAY_TOC =1;
HH_DISPLAY_INDEX =2;
HH_HELP_CONTEXT = 15;
function HtmlHelpA (hWndCaller: HWND; pszFile: PAnsiChar; uCommand: UINT; dwData: DWORD): HWnd;
external '[email protected] stdcall';
function HtmlHelp(hWndCaller: HWND; pszFile: String; uCommand: UINT; dwData: DWORD): HWnd;
begin
try
result := HtmlHelpA(hWndCaller,pszFile,uCommand,dwData);
except
MsgBox('Unable To Display Help file.', mbError, MB_OK);
end;
end;
function InitializeSetup : Boolean;
begin
HtmlHelp(0,'MyProg.chm',HH_DISPLAY_TOC,0);
result := true;
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
hhctrl.ocx
中的HtmlHelpA
或HtmlHelpW
函数,此内容记录在 MSDN。
You can use the
HtmlHelpA
orHtmlHelpW
function inhhctrl.ocx
This is documented in MSDN.
恕我直言,这要简单得多:
不需要所有代码。只需使用 hh.exe 调用 CHM 文件即可。
This is much simpler IMHO:
No need for all that code. Just invoke the CHM file using
hh.exe
.