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);