.CHM Help File is Displayed Topmost Over the .NET Application's Window

If you integrate a .CHM help file with your .NET application which can be written in C# or VB.NET, you might have noticed that the HTML Help's viewer window is displayed topmost over the application's window.

Using the Help.ShowHelp() Method

No matter if you have disabled the topmost option for the Main window in your help authoring tool, or pass Null or Nothing value to the Help.ShowHelp() method, it will still be show topmost.

CHM file shown on the top over the calling window in a .NET app.
CHM file shown on the top over the calling window in a .NET app.

Fortunately, there is a non-obvious yet simple solution to this problem.

Make the HTML Help (CHM) Viewer's Window be Displayed Normally

The HTML Help (CHM) Viewer's window opened by HelpProvider is always on top of the parent window control, which is specified by Control instance in the first parameter of the Help.ShowHelp() method.

As a solution to this problem, we can write a function that will create a temporary (hidden) form.

public static class AppHelp {
	private static Form mFrmTemp = new Form();

	public static void ShowChm() {
		Help.ShowHelp(mFrmTemp, "my_help_file.chm");
	}
}

How it works?

In the above solution, we create a temp form that will be used as the HTML Help's parent form. When we call the CHM help file, the HTML Help viewer will be displayed topmost over the temp form. However, now it will NOT be on top of the application's windows.

Now we can use the described method call the .CHM help in other places of the application.

That's the trick!

Comments

No one has left a comment for this page yet. Be the first person to write a comment!

Add a Comment

Full name:
Comment:
Enter the code on the image:
Security image

Download a CHM Creation Tool

After watching the video which explains how you can create a CHM file with a help authoring tool, you may want to download the application whose basic features we have demonstrated. If you need more information on creating and using HTML Help (CHM) files, you can also visit the related links in the right box.

Help file maker main window
Click on the screenshot to view it in full size.
Details Value
Filename HelpSmithSetup.exe
File size 64 MB
Platform Windows 11/10/8/7
System
requirements
1 GHz processor, 512MB RAM, 150MB free disk space