Reputation: 99
How to do that when I'm in the main window of my system by pressing F1 will display the help muetre in pdf format. how do I intercept was pressed the F1 key on my main window?
I use Delphi XE2
Thanks for the help!
Upvotes: 1
Views: 630
Reputation: 125669
Use the Application.OnHelpCommand
event, which you can either assign in code:
interface
type
TForm1 = class(TForm)
// IDE generated code
private
procedure AppOnHelp(Command: Word; Data: Integer;
var CallHelp: Boolean);
end;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnHelp := AppOnHelp;
end;
Or assign by using a TApplicationEvents
component and creating a handler for the OnHelp
event in the Object Inspector's Events tab.
You can set CallHelp
to false to prevent the normal help processing, and launch your own help file via ShellExecute
.
procedure TForm1.AppOnHelp(Command: Word; Data: Integer;
var CallHelp: Boolean);
begin
CallHelp := False;
// Launch your own help here
end;
Upvotes: 1