Reputation: 45
In Windows 7, if I run a game like Minesweeper or Mahjong Titans, then choose "help" from the game's menu, I get a standalone help window, from which I can navigate to other topics (presumably all the help files that came with the OS). Note that I always have "offline help" selected, not "online help."
I would like to open these files from a button-click event in C#. The problem is, I don't know where these files are stored, or even with what extension.
When I have the standalone help window open, the task manager lists the process as "HelpPane.exe" which is located in C:\Windows. If I try to double-click on HelpPane.exe, nothing happens.
If I right-click on the help window and choose "view source", I see that it is basically a web page. An example <body> tag is:
<BODY helptype="toc" helpurl="mshelp://windows/?tocid=ebd9c148-6e8d-4359-83d5-f4b700ab2f8f" helpsource="local" Lang="en-US">
Can I access mshelp://windows/... from a C# program? Or is there another way to do what I want?
Upvotes: 2
Views: 786
Reputation: 941705
HelpPane.exe is an out-of-process COM server. You can activate it and get it to display content in your own C# program easily. To get started, use Project + Add Reference and select c:\windows\helppane.exe. That creates the interop library from the COM type library embedded in helppane.exe, generated with the "APClientHelpPane" namespace.
A sample program that displays the Windows Help Topics content file:
using System;
using WinHelp = APClientHelpPane;
class Program {
static void Main(string[] args) {
var obj = new WinHelp.HxHelpPaneServer();
string docpath = @"C:\Windows\Help\Windows\ContentStore\en-US\windowsclient.mshc";
obj.DisplayContents(docpath);
}
}
Tested on the en-US edition of Windows 8.1. No real idea how much luck you'll have with it on Windows 7, I suspect you'll have to modify the path to the .mshc file. This should concern you of course. Microsoft also has no obligation to keep this working on future versions of Windows, this Automation interface is not documented. Reverse-engineering the topic names for the various Windows programs is not that obvious, I suspect you can use the mshelp:// URLs that you find by inspecting the displayed content but how stable they are across Windows versions is something you'll have to find out the hard way.
The Microsoft Help Viewer SDK should interest you. MSHC authoring tools are mentioned in this blog post.
Upvotes: 5