How to display a help file on top of a form with style fsStayOnTop (Views: 33)


I have a form with its formstyle set to fsStayOnTop. If I display the help for this form, the help windows is opened behind my form. Even if I click on the help window it stays behind. How can I display the help windows in front of any form?


You can do this by sending a macro to WinHelp.

procedure TForm1.Button1Click(Sender: TObject);
  with Application do
    Helpfile := 'C:\Programme\Borland\Delphi5\Help\TOOLS\HCW.HLP';
    HelpCommand(HELP_CONTENTS, 0);
    HelpCommand(HELP_COMMAND, Integer(PChar('Generate(' + IntToStr(WM_COMMAND)
      + ', 1471, 0)')));

This macro call fakes a menu action for the "keep on top" menu item. Use 1472 to deactivate the on top state. Help macros are documented in the helpfile I used above. The HelpOnTop macro gives the menu IDs to use for Generate in this case. HelponTop itself may be useful if you simply want to change the current on-top default for the window (it is a toggle).

<< Back to main page