• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Displaying HelpOnHelp in XP?

Has HelpOnHelp been discontinued in XP?  The following code works fine in 98 but not XP:

  Application.HelpCommand(HELP_HELPONHELP, 0);

Chris Bray.
0
chrisbray
Asked:
chrisbray
  • 3
1 Solution
 
shaneholmesCommented:
is the HelpContext property on the main form set to  something other than 0 ?

sholmes
0
 
chrisbrayAuthor Commented:
Hi Shane,

No.  But that shouldn't matter anyway - HELP_HELPONHELP is defined in Windows.pas as an external API call to the Windows help system and should display the 'how to use help' help file.

I suspect that it has been moved or discontinued under Win XP and therefore the call is simply ignored.

Chris Bray.
0
 
BlackTigerXCommented:
you're right...
http://www.elists.org/pipermail/delphi/2002-August/021317.html

procedure TForm1.ShowHelpOnHelp;
var OldHelp: string;
begin
OldHelp := Application.HelpFile;
if OSIsWinXP then begin
  Application.HelpFile := GetSystem32Path+'\winhelp.hlp';
  Application.HelpCommand (HELP_CONTENTS, 0);
  end
else begin
  Application.HelpFile := 'winhlp32.hlp';
  Application.HelpCommand (HELP_HELPONHELP, 0);
  end;
Application.HelpFile := OldHelp;
end;
0
 
chrisbrayAuthor Commented:
Hi BlackTigerX,

Thank you for that information.  There are a couple of minor problems with what you provided, but it certainly pointed me in the right direction so you get the points...

Problems arise when used in conjunction with THTMLHelpRouter, and MS state that the minor version for XP is 1 although it does indeed seem to return the correct value - odd that one.  According to MS the OSIsWinXP function as written should return False since 0 should match with Win2k...

Anyway, all my problems were resolved as follows:

procedure TMainForm.HowtoUseHelp1Click(Sender: TObject);
var
  OldHelp: string;
begin
  OldHelp := Application.HelpFile;
  if OSIsWinXP then
    begin
      ShellExecute(Handle,'open',PChar(GetSystem32Path+'\winhelp.hlp'), nil,nil,SW_SHOWNORMAL);
    end
  else
    begin
      Application.HelpFile := 'winhlp32.hlp';
      Application.HelpCommand (HELP_HELPONHELP, 0);
      Application.HelpFile := OldHelp;
    end;
end;
0
 
chrisbrayAuthor Commented:
Quick code correction:

procedure TMainForm.HowtoUseHelp1Click(Sender: TObject);
var
  OldHelp: string;
begin
  if OSIsWinXP then
    begin
      ShellExecute(Handle,'open',PChar(GetSystem32Path+'\winhelp.hlp'), nil,nil,SW_SHOWNORMAL);
    end
  else
    begin
      OldHelp := Application.HelpFile;
      Application.HelpFile := 'winhlp32.hlp';
      Application.HelpCommand (HELP_HELPONHELP, 0);
      Application.HelpFile := OldHelp;
    end;
end;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now