chm如何调用帮助文档档的调用

VC_MFC(2)

(1)用Word编辑好帮助文档,并保存为网页格式,如mhtml格式。
(2)用EasyCHM软件生成chm文档。生成方法很简单的,相信你能很快搞定的!当然用其它方法制作CHM文档也可以了。
(3)在MFC中添加一个菜单或按钮,添加相应的响应函数。
(4)在函数体内用&ShellExecute(NULL,&open&,&.\\help.chm&,NULL,NULL,SW_SHOWMAXIMIZED);
说明:&为文件路途和文件名,\\为当前目录
SW_SHOWMAXIMIZED&为最大化文档窗口,参考MSDN,还有如下一些参数可选:
Hides the window and activates the executable file.
SW_MAXIMIZE
Maximizes the window.
SW_MINIMIZE
Minimizes the window. The next top-level window in the Z-order is activated.
SW_RESTORE
Activates the window even if it is hidden or minimized
Activates the window and displays it in its original size and at its original position.
SW_SHOWMAXIMIZED
Activates the window. The window is displayed as maximized.
SW_SHOWMINIMIZED
Activates the window. The window is displayed as minimized.
SW_SHOWMINNOACTIVE
Activates the window as minimized. The active window retains the focus.
Activates the window in its current state but the active window retains the focus.
SW_SHOWNOACTIVATE
Displays the window in its most recent size and in its most recent position. The active window retains the focus.
SW_SHOWNORMAL
Displays the window in its original size and at its original position.
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:11398次
排名:千里之外
(2)(1)(2)(5)(3)在C#中使用.chm帮助文件
将编译好的.chm帮助文件(可以用EasyCHM进行制作,下载地址:http://download.csdn.net/detail/xiaoyaofriend/4501571)添加到C# 编写的程序中时,需要调用Help类的ShowHelp和ShowHelpIndex静态方法。下面对这两个...
将编译好的.chm帮助文件(可以用EasyCHM进行制作,下载地址:http://download.csdn.net/detail/xiaoyaofriend/4501571)添加到C# 编写的程序中时,需要调用Help类的ShowHelp和ShowHelpIndex静态方法。下面对这两个方法进行详细介绍。
(1)ShowHelp方法。显示帮助文件的内容。该方法有4种重载形式,它们的语法形式分别如下。
public static void ShowHelp (Control parent,string url)
参数说明如下。
parent:标识“帮助”对话框的父级的Control。
url:帮助文件的路径和名称。
返回值:显示指定URL处的帮助文件内容。
public static void ShowHelp (Control parent,string url,HelpNavigatornavigator)
参数说明如下。
parent:标识“帮助”对话框的父级的Control。
url:帮助文件的路径和名称。
navigator:HelpNavigator值之一。HelpNavigator值
public static void ShowHelp (Controlparent,string url,string keyword)
参数说明如下。
parent:标识“帮助”对话框的父级的Control。
url:帮助文件的路径和名称。
keyword:要为其显示帮助信息的关键字。
返回值:显示在指定URL处找到的有关特定关键字的帮助文件内容。
public static void ShowHelp (Control parent,string url,HelpNavigatorcommand,Object parameter)
参数说明如下。
parent:标识“帮助”对话框的父级的Control。
url:帮助文件的路径和名称。
command:HelpNavigator值之一。 HelpNavigator值及说明如表4所示。
Parameter:任意类型的参数。
返回值:显示位于用户提供的URL处的帮助文件内容。
(2)ShowHelpIndex方法。显示指定帮助文件的索引。
public static void ShowHelpIndex (Control parent,string url)
在Windows应用程序中调用.chm帮助文件
本示例实现的是,当程序运行时,单击【help】按钮,在程序中调用.chm帮助文件。
程序主要代码。
private void bnthelp_Click(object sender, EventArgs e)
string helpfile = Application.StartupPath.Substring(0,Application.StartupPath.Substring(0,Application.Startup Path.LastIndexOf("\\")).LastIndexOf("\\"));
helpfile+=@"\help\mrHelp.chm";
Help.ShowHelp(this,
helpfile);
Help.ShowHelpIndex(this,
helpfile); //显示指定帮助的索引
完整程序代码如下:
★★★★Form1.cs窗体代码文件完整程序代码★★★★★
using System.Collections.G
using System.D
using System.D
using System.T
using System.Windows.F
namespace _5_02
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void Form1_Load(object sender, EventArgs e)
private void bnthelp_Click(object sender, EventArgs e)
string helpfile = Application.StartupPath.Substring(0,Application.StartupPath.Substring(0,Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
helpfile+=@"\help\mrHelp.chm";
Help.ShowHelp(this,
helpfile);
Help.ShowHelpIndex(this,
helpfile); //显示指定帮助的索引
private void button1_Click(object sender, EventArgs e)
★★★★Form1.Designer.cs窗体代码文件完整程序代码★★★★★
namespace _5_02
partial class Form1
/// &summary&
/// 必需的设计器变量。
/// &/summary&
ponentModel.IContainer components =
/// &summary&
/// 清理所有正在使用的资源。
/// &/summary&
/// &param name="disposing"&如果应释放托管资源,为 true;否则为 false。&/param&
protected override void Dispose(bool disposing)
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
#region Windows 窗体设计器生成的代码
/// &summary&
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// &/summary&
private void InitializeComponent()
this.bnthelp = new System.Windows.Forms.Button();
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
this.SuspendLayout();
// bnthelp
this.bnthelp.Location = new System.Drawing.Point(91, 34);
this.bnthelp.Name = "bnthelp";
this.bnthelp.Size = new System.Drawing.Size(70, 23);
this.bnthelp.TabIndex = 0;
this.bnthelp.Text = "help";
this.bnthelp.UseVisualStyleBackColor =
this.bnthelp.Click += new System.EventHandler(this.bnthelp_Click);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.F
this.ClientSize = new System.Drawing.Size(292, 99);
this.Controls.Add(this.bnthelp);
this.Name = "Form1";
this.Text = "帮助引用";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
#endregion
private System.Windows.Forms.B
private System.Windows.Forms.HelpProvider helpProvider1;
★★★★Program.cs主程序文件完整程序代码★★★★★
using System.Collections.G
using System.Windows.F
namespace _5_02
static class Program
/// &summary&
/// 应用程序的主入口点。
/// &/summary&
[STAThread]
static void Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
(3)通过进程Process去调用。
For example:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "helpfile.chm";
p.Start();
在Web中好像还没有比较好的查看chm的方法。
(4)HelpProvider控件
HelpProvider控件可以挂起控件,显示帮助主题。
SetShowHelp()方法:设置指定控件是否显示帮助信息;
HelpNamespace()方法:设置帮助文件;
SetHelpKeyword()方法:为帮助文件设置关键字;
SetHelpNavigator()方法:设置显示帮助中的元素;
SetHelpString()方法:将帮助信息的文本字符串关联到控件上。
具体步骤如下:
A帮助按钮不能与最大化和最小化按钮同时存在。
设置窗体属性:
MaximizeBox=
MinimizeBox=
HelpButton=
B添加控件helpProvider
该控件可以带有帮助文件,chm
C将helpProvider控件和窗体联系起来
设置窗体属性:(别的控件也一样)
HelpKeyword on helpProvider 索引和帮助文件中的索引对应
HelpNavigator on helpP
D给控件helpProvider加载帮助文件
public Form1()
InitializeComponent();
string strpath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
strpath += @"\mrHelp.chm";
helpProvider1.HelpNamespace =
E实现点击?帮助按钮实现F1的功能
在帮助按钮的点击事件中
private void Form1_HelpButtonClicked(object sender, CancelEventArgs e)
SendKeys.Send("{F1}");
//SendKeys.SendWait("{F1}");
使用代码实现:
TestHelpProvider:
using System.Collections.G
using System.D
using System.D
using System.T
using System.Windows.F
namespace TestHelpProvider
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void Form1_Load(object sender, EventArgs e)
//将帮助信息的文本字符串关联到控件上,在相应控件上按下F1键时显示
helpProvider1.SetHelpString(textBox1, "Enter an age that is less than 65.");
helpProvider1.SetHelpString(textBox2, "Enter a 5 digit post code.");
作者:xiaoyaofriend君,已阅读到文档的结尾了呢~~
chm帮助文档制作并在程序内调用
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
chm帮助文档制作并在程序内调用
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口您的位置: &
常用CHM帮助文档集锦下载
【IT168知识库】
&这是我的BLOG里的一篇文章,包括了大部分常用的CHM帮助文档,拿到园子里与大家分享一下,各文档版权归原作者所有.如果你有好的参考资料,希望能给我发一份.
=========================================
使用说明:由于有很多朋友反应部分CHM文件打不开。这里的文件我都测试过。
测试操作系统:Windows 2003 SP1 R2 ,因为有些文件可能有外部调用,所以系统会提示。&
如果遇到以下提示:(这里以asp中文.chm为例)
请将将“打开此文件前总是询问”前面的勾去掉,再点打开。
好了,如果还是打不开,就给我留言啦。
=========================================
ADO 2.5 Microsoft ADO 2.5 程序员参考.chmADO.NET_微软出版社 《ADO.Net技术内幕》《Microsoft ADO.Net Core Reference 》.NET.En.chmADO210.CHMasp.net 2.0_Apress.ASP.Dot.NET.2.0.Revealed.eBook-LiB.chmasp中文.chmASP基础教材.chmasp帮助.chmASP应用手册.chmASP编程完全手册 1.0(任风流 整理制作).chmCrystal_水晶报表中文帮助手册(CHM).chmCSharp(作者Scott Wiltamuth 和 Anders Hejlsberg)[精简整理人员Eyas Studio].chmcss.chmcss20(苏昱).chmcss20.chmcss2gb.chmCSS_5日精通CSS层叠样式表.chmCSS_精通CSS滤镜.chmCSS样式表.CHMcss样式表滤镜.chmC语言编程宝典.chmDELPHI基础教程.chmDHTML 手册(lemon).chmDHTML.CHMDHTML_5日学会动态HTML.chmDHTML文档对象模型.CHMDHTML默认行为.chmDOS实例手册.chmDOTNET_使用 Microsoft .NET 的企业解决方案模式.chmEnglish_英语书大全.chmEnglish_英语资料大全.chmFlash8help_cn(Flash 8 帮助).chmFVSDKMasmAll.chmFWHelp8_cn(Fireworks 帮助).chmhtml基础教程.chmInterdev6.chmJava_[OReilly] Java Servlet Programming 2nd.chmJAVA_Thinking in Java(中文版 由yyc,spirit整理).chmJAVA_完完全全的中文版Java API_Sun公司官方出版.chmJAVA_精通swing程序设计.chmJavaScript 5.CHMjavascript5.5.chmJavaScript对象与数组参考大全 .chmJavaScript权威指南(英文版).chmJAVA语言入门 .chmJet sql.chmjscript5.5docs.CHMJSP_图解JSP环境安装配置.chmJSP语法(中华电脑书库 整理制作).chmlogo设计.chmMySQL 4.1.0.chmMySQL.chmMySQL中文参考手册.chmMySQL中文参考手册_.chmNet.chmPerl_CGI六天入门.chmPHP4 中文参考手册.chmPHP4.chmphp4gb.chmPHP4完全中文手册.chmPHP5学习(全英文).chmphp手册-PHP5研究室编译 无乱码版本.chmPHP手册.chmPHP的一些例程.chmPHP编码规范.chmPowerBuilder使用技巧集.chmPowerBuilder系列讲座.chmPowerBuilder编程技巧.chmscript(windows脚本技术,中文版).CHMscript56(最新的Script帮助文档 英文版,类似于MSDN).chmSQL Server精华 (CHM).chmSQL语言参考大全(CHM版)2.1M.chmStruts Taglibs-chm.chmTomcat.chmValidato_表单验证 Validator v1.0(作者 我佛山人).chmVBSCRIP5.CHMVisual InterDev 6.0 使用指南.chmwin32api(新编WINDOWSAPI大全).chmWindows 程序设计ProgrammingWindows.chmWINDOWS脚本技术.chmXML_Oreilly.Learning.XML.2nd.Edition.eBook-LiB.chmXML指南CHM版.chm正则表达式系统教程.CHM红客教程.chm网页设计配色常识.chm设计模式迷你手册(RedSword软件工作室).chm软件工程思想.chm-----------------------------------------由于同步更新太麻烦,想下载的朋友请直接到&下载如果哪个下载不了或是有问题,请您留言.谢谢!&&
热点文章排行
All Right Reserved. 北京皓辰网域网络信息技术有限公司. 版权所有 京ICP证:060528号

我要回帖

更多关于 如何调用帮助文档 的文章

 

随机推荐