无需打开另一个窗口即可跳转至 CHM 帮助文件中的主题

发布于 2024-11-13 04:57:33 字数 1897 浏览 4 评论 0原文

我在安装程序中包含了一个精简的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咿呀咿呀哟 2024-11-20 04:57:33

您可以使用 hhctrl.ocx 中的 HtmlHelpAHtmlHelpW 函数,

此内容记录在 MSDN

; -- Example1.iss --
; Demonstrates copying 3 files and creating an icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[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,'C:\Program Files (x86)\Inno Setup 5\ISetup.chm',HH_DISPLAY_TOC,0);
  result := true;
end;

You can use the HtmlHelpA or HtmlHelpW function in hhctrl.ocx

This is documented in MSDN.

; -- Example1.iss --
; Demonstrates copying 3 files and creating an icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[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,'C:\Program Files (x86)\Inno Setup 5\ISetup.chm',HH_DISPLAY_TOC,0);
  result := true;
end;
花间憩 2024-11-20 04:57:33

恕我直言,这要简单得多:

Filename: "{win}\hh.exe"; \
    Parameters: "{app}\MeetSchedAssist.chm::/msa-revision-history.htm"; \
    WorkingDir: "{app}"; \
    Flags: nowait postinstall runmaximized; \
    Description: "{cm:ViewChangeHistory}"

不需要所有代码。只需使用 hh.exe 调用 CHM 文件即可。

This is much simpler IMHO:

Filename: "{win}\hh.exe"; \
    Parameters: "{app}\MeetSchedAssist.chm::/msa-revision-history.htm"; \
    WorkingDir: "{app}"; \
    Flags: nowait postinstall runmaximized; \
    Description: "{cm:ViewChangeHistory}"

No need for all that code. Just invoke the CHM file using hh.exe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文