0

I have added .chm help file in C# application and able to open. I would like to close the opened file from program but not getting. Got multiple answers to open the .chm but not for close.

Edit 1: I am not using WPF or WinForm. I am adding it to the SolidWorks add-in application. Added the reference for windows form. Here is my code for open .chm

public void Help()
{
    string helpFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @" TestFolder\Help.chm");

    var file = new FileInfo(helpFilePath);
    if (!IsFileinUse(file))
    {
        System.Windows.Forms.Help.ShowHelp(null, helpFilePath);
    }
}

help-info.de
  • 6,695
  • 16
  • 39
  • 41
  • 1
    How do you use chm-files? For what? You can [close another process](https://stackoverflow.com/q/6046916/1997232), but chm-files are *usually* help-files invoked when user need help (e.g. by pressing F1) and it's job of the user to close them. – Sinatr Aug 28 '20 at 13:28
  • 1
    in order to get good answer you need to ask a good question, please read: https://stackoverflow.com/help/how-to-ask – Nawed Nabi Zada Aug 28 '20 at 13:30
  • 2
    Yes, please show the code you used to open the .chm file and whether this is a WinForm or WPF application. – Jay Buckman Aug 28 '20 at 13:40
  • [Similar question](https://stackoverflow.com/q/59909028/12888024). Try `Process.Start(helpFilePath)` instead, at least because you'll have an ability to `Kill()` the process. – aepot Sep 27 '20 at 18:36

0 Answers0