Board index » delphi » Winhelp process is started every time F1 is pressed

Winhelp process is started every time F1 is pressed


2007-09-19 10:26:33 PM
delphi267
I have a Delphi2006 application using WinHelpViewer and performing the
following code when the menu item Help contents is selected, or F1 is
pressed.
procedure TForm_Main.SubMenu_ContentsClick(Sender: TObject);
begin
Application.HelpFile := ExtractFilePath(Application.ExeName)
+'MyHelp.hlp';
Application.HelpCommand(HELP_FINDER, 0);
end;
Every time the user does this, a new winhlp32.exe process is started.
So after some time the machine slows down with many winhlp32.exe
processes running and consuming the CPU.
I have tried to add a statement before the current line
with ...HelpCommand...:
Application.HelpCommand(HELP_QUIT,0);
to force the running winhlp32.exe to stop before the next starts, but
this does not work.
Any suggestions, please?
 
 

Re:Winhelp process is started every time F1 is pressed

On Sep 19, 10:26 pm, XXXX@XXXXX.COM writes:
Quote
I have a Delphi2006 application using WinHelpViewer and performing the
following code when the menu item Help contents is selected, or F1 is
pressed.

procedure TForm_Main.SubMenu_ContentsClick(Sender: TObject);
begin
Application.HelpFile := ExtractFilePath(Application.ExeName)
+'MyHelp.hlp';
Application.HelpCommand(HELP_FINDER, 0);
end;

Every time the user does this, a new winhlp32.exe process is started.
So after some time the machine slows down with many winhlp32.exe
processes running and consuming the CPU.

I have tried to add a statement before the current line
with ...HelpCommand...:
Application.HelpCommand(HELP_QUIT,0);
to force the running winhlp32.exe to stop before the next starts, but
this does not work.

Any suggestions, please?
HI
I am sure... the Application.HelpFile :=
ExtractFilePath(Application.ExeName)+'MyHelp.hlp';
should only be called once...
I call it in the .Dpr
you then only call the Application.HelpCommand(HELP_FINDER, 0);
with a different index... to go to the right page.
and then the Application.HelpCommand(HELP_QUIT, 0);
when you close your application.
hope this helps