2

I want to add help.chm or help.pdf in application.

Where to add these files and how to call them during button click or on F1 key pressed?

i have also used following code for F1 key press but i am not able to call the help file any how

<Window.CommandBindings>
    <CommandBinding Command='ApplicationCommands.Help' Executed='Window_Help_Executed'></CommandBinding>
</Window.CommandBindings>

Please Provide me any Solution.

Thanks

Neel Bhasin
  • 749
  • 1
  • 7
  • 22
  • 1
    And what is inside `void Window_Help_Executed()` ? Have you tried a breakpoint? – H H Sep 02 '13 at 13:10
  • This Stackoverflow question may help you http://stackoverflow.com/questions/6094053/open-chm-help-file-in-c-sharp – mircea Sep 02 '13 at 13:13
  • i put a messagebox here it is working fine but when i am trying to access my help.chm and help.pdf through `Help.ShowHelp` and `Process.Start` i am not able to view any of the file. files are there in my application directory where all the class files and windows are lying. – Neel Bhasin Sep 02 '13 at 13:14
  • @mircea i already tried that way..... – Neel Bhasin Sep 02 '13 at 13:15
  • Try with a very simple app. Check the path to the file to be correct. Check also the .chm file integrity. Use a full path to specify the file. – mircea Sep 02 '13 at 13:18
  • 2
    So, the XAML code is working and the C# code is not. Then please post the code behind. – H H Sep 02 '13 at 13:20
  • @mircea actually i am not able to get the file path and not able to integrate the .chm file. – Neel Bhasin Sep 02 '13 at 13:21
  • @HenkHolterman i am trying to access it through `Process.Start(@"help.chm")` and also by `Help.ShowHelp(null,@"help.chm")` both are not working. – Neel Bhasin Sep 02 '13 at 13:24
  • Use a hard coded full path like c:\file.chm in order to narrow down the problem. – mircea Sep 02 '13 at 13:27

1 Answers1

2

You can open your help file with the Process class... view the Process Class page at MSDN for more information:

Process.Start("help.chm");

For this to work, you will need to place the 'help.chm' file in the 'bin' folder where your executable is. You could put this file elsewhere as long as you use the correct relative path from your application executable file to it. You will also need to add the following:

using System.Diagnostics;
Sheridan
  • 68,826
  • 24
  • 143
  • 183
  • thanks.... is there any other way? – Neel Bhasin Sep 02 '13 at 13:26
  • 2
    This *is* the way... your problem is probably that your help file is not in the correct folder. Move it to the exact `bin` folder that you are currently building into, eg. if you are running in the `x86` platform and `Debug` configuration, then you should move the help file to the YourAppName > bin > Debug folder. If you still have problems, for testing, move it to the root of the C drive and call this code: `Process.Start("C:\\help.chm");` – Sheridan Sep 02 '13 at 13:33