开发者

Jumping to a topic in a CHM help file without opening another window

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 anoth开发者_开发知识库er 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 'HtmlHelpA@hhctrl.ocx 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;


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 'HtmlHelpA@hhctrl.ocx 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;


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜