简体   繁体   English

无法单独打开Windows 7帮助文件

[英]Can't open windows 7 help files standalone

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). 在Windows 7中,如果我运行Minesweeper或Mahjong Titans之类的游戏,然后从游戏菜单中选择“帮助”,我将获得一个独立的帮助窗口,从中可以导航到其他主题(大概是随Windows附带的所有帮助文件)。 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#. 我想通过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. 当我打开独立的帮助窗口时,任务管理器将进程列出为“ HelpPane.exe”,位于C:\\ Windows。 If I try to double-click on HelpPane.exe, nothing happens. 如果我尝试双击HelpPane.exe,则不会发生任何反应。

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>标签的示例是:

<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? 我可以从C#程序访问mshelp:// windows / ...吗? Or is there another way to do what I want? 还是有其他方法可以做我想要的?

HelpPane.exe is an out-of-process COM server. HelpPane.exe是进程外COM服务器。 You can activate it and get it to display content in your own C# program easily. 您可以激活它并获取它以便轻松地在自己的C#程序中显示内容。 To get started, use Project + Add Reference and select c:\\windows\\helppane.exe. 首先,使用Project + Add Reference,然后选择c:\\ windows \\ helppane.exe。 That creates the interop library from the COM type library embedded in helppane.exe, generated with the "APClientHelpPane" namespace. 这将从嵌入在helppane.exe中的COM类型库创建互操作库,该库是使用“ APClientHelpPane”命名空间生成的。

A sample program that displays the Windows Help Topics content file: 显示Windows帮助主题内容文件的示例程序:

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. 在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. 根本不知道您在Windows 7上会有多大的运气,我怀疑您必须修改.mshc文件的路径。 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. Microsoft也没有义务继续在Windows的将来版本上使用此功能,该自动化界面未记录。 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. 对各种Windows程序的主题名称进行反向工程不是很明显,我怀疑您可以使用通过检查显示的内容找到的mshelp:// URL,但是您必须在各个Windows版本中确保它们的稳定性找出困难的方法。

The Microsoft Help Viewer SDK should interest you. Microsoft Help Viewer SDK应该使您感兴趣。 MSHC authoring tools are mentioned in this blog post . 本博客文章中提到了MSHC创作工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM