VC中调用CHM帮助文件[2]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 afxapi 的 blog

1、在c/c++选项卡的category的列表中选择preprocessor,在additional include directories框中填入htmlhelp.h的地址(例如:

c:\program files\html help workshop\include\htmlhelp.h)。
2、在link选项卡的gategory的列表中选择input,在additional library path框中填入htmlhelp.lib的地址(例如:c:\program files\html

help workshop\lib\htmlhelp.lib)。
3、在link选项卡的gategory的列表中选择general,在object/library modules框中填入htmlhelp.lib。
 

假设要调用chm的应用程序为sdi程序,且编译好的帮助文件和程序在同一目录下。(示例代码中chm文件名为help.chm,getmodulefilename用于获得帮助文件路径。)


1、在stdafx.h中加入htmlhelp.h:#include "htmlhelp.h"
2、调用chm:

char szfilepath[max_path],szpath[max_path];
getmodulefilename(null,szfilepath,max_path); //获得当前程序目录
size_t ipos = strlen(szfilepath) - strlen(strrchr(szfilepath,'\\'));
strncpy(szpath,szfilepath,ipos);
strcat(szpath,"\\help.chm");
htmlhelp(null,szpath,hh_display_topic,null);


本文关键:VC中调用CHM帮助文件
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top