单击按钮以在 VB.NET 中显示 .CHM 帮助文件
我想在单击 VB.NET 中的按钮时显示 .CHM 帮助文件。谁能告诉我代码如何做到这一点?
Private Sub cmdHelp_Click(ByVal sender As System.Objects, Byval e As System.EventArgs)Handles cmdHelp.Click
'Please help provide some code
End Sub
I want to display a .CHM help file when clicking on a button in VB.NET. Could anyone show me code how to do this?
Private Sub cmdHelp_Click(ByVal sender As System.Objects, Byval e As System.EventArgs)Handles cmdHelp.Click
'Please help provide some code
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
.NET API 在
System.Windows.Forms
命名空间中提供Help
类。一些例子:The .NET API offers the
Help
class in theSystem.Windows.Forms
namespace. Some examples:使用
open
动词执行 Process.Start 可以解决问题:请注意,从 WinXP SP3(SP2?) 开始,
.chm
文件受到操作系统的严格限制 - 它们被认为存在合理的安全风险,因此您无法直接从网络或远程位置打开它们。您需要进行相应的编码,并在尝试打开它们时预期会出现异常。Doing a Process.Start with a verb of
open
does the trick:Note that
.chm
files are heavily restricted by the OS from about WinXP SP3 (SP2?) onwards - they are considered to be a reasonble security risk, so you can't open them directly from a network or remote location. You will need to code accordingly, and expect exceptions when trying to open them.在按钮单击事件上编写此代码
其中 hh.exe 是任意名称 App.Helpfile 是您的 chm 文件名
on Button click event write this code
Where hh.exe is any name App.Helpfile is your chm file name
您还可以使用 HH.EXE 显示指定的主题。
在示例代码中
将
[topicid]
替换为真实主题 id并将
[yourhelpfile.chm]
替换为 .chm 文件的完整路径和名称(如果需要返回值
,否则只需此值)
You can also use HH.EXE to display a specified topic.
In the example code
replace
[topicid]
with the real topic idand replace
[yourhelpfile.chm]
with the full path and name of your .chm fileIf a return value is required
otherwise just this