HTML帮助研讨会成功编译.chm文件后返回错误 [英] HTML Help Workshop returns error after successfully compiled .chm file

查看:467
本文介绍了HTML帮助研讨会成功编译.chm文件后返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过 HTML帮助研讨会 hhc.exe 成功编译.chm文件之后,我面临着一个非常奇怪的失败。

I'm facing a quite weird failure after I successfully compiled a .chm file with HTML Help Workshop's hhc.exe.

我用 Doxygen 创建了源代码文档。如果在doxygen文件中启用 GENERATE_HTMLHELP ,则会创建 Doxygen

I created a documentation of my source code with Doxygen. Doxygen creates if you enable GENERATE_HTMLHELP in the doxygen file:


如果将GENERATE_HTMLHELP标记设置为YES,则doxygen会生成三个另外的
HTML索引文件:index.hhp,index.hhc和index.hhk。 index.hhp

是一个项目文件,Microsoft的HTML帮助研讨会可以读取(请参阅:

http://www.microsoft.com/zh-cn/download/details.aspx?id=21138 ) 。

Doxygen 创建了这些文件之后,我想用 HTML创建.chm文件帮助研讨会。因此,我在CMD中调用 hhc.exe 。之后,我可以打开.chm文件,一切似乎都很好。但是,如果我向CMD请求当前的错误级别,它将输出:

After Doxygen creates those files, I want to create the .chm file with HTML Help Workshop. For that reason I call hhc.exe in a CMD. After that I can open the .chm file and everything seems fine. But if I ask the CMD for the current errorlevel, it outputs:

"C:\Program Files (x86)\HTML Help Workshop\hhc.exe" index.hhp
Microsoft HTML Help Compiler 4.74.8702

Compiling C:\... folder path ...\index.chm

Compile time: 0 minutes, 0 seconds
37      Topics
346     Local links
12      Internet links
0       Graphics

Created C:\... folder path ...\index.chm, 88,740 bytes
Compression decreased file by 194,682 bytes.

echo %errorlevel%
1

是否有人h ...出了什么问题的想法,如何避免成功编译但仍然返回错误的问题?如何找出问题而不是错误 1?

Does anyone have an idea of what the h... is going wrong here and how I can avoid that problem that it's compiled successfully but still returns an error? How can I figure out what's the problem instead of an error "1"?

问题是我的构建服务器(TFS2015)返回错误并且构建失败。

The problem is that my build server (TFS2015) returns the error and the build is failed.

推荐答案

HTML帮助研讨会已安装了2个主要可执行文件:

HTML Help Workshop is installed with 2 main executables:


  1. hhc.exe 是HTML帮助编译器的控制台版本。

  2. hhw.exe 是HTML帮助编译器的 Windows GUI版本。

  1. hhc.exe is the console version of the HTML Help Compiler.
  2. hhw.exe is the Windows GUI version of HTML Help Compiler.

但这两个可执行文件并不直接完成HTML帮助项目(hhp)到已编译HTML(chm)的编译。

But the compilation of the HTML Help Project (hhp) to Compiled HTML (chm) is not directly done by those two executables.

两者均用于编译 hha.dll -HTML帮助作者库-通过调用导出的函数 HHA_CompileHHP

Both use for compilation hha.dll - the HTML Help Author library - by calling the exported function HHA_CompileHHP.

该库的导出函数为:


  • EditHhCtrlObject

  • EditHhCtrlScript

  • FreeFilterDIB

  • HHA_Comp ileHHP

  • LoadFilterImage

  • LoadJpeg

  • EditHhCtrlObject
  • EditHhCtrlScript
  • FreeFilterDIB
  • HHA_CompileHHP
  • LoadFilterImage
  • LoadJpeg

Microsoft有据我所知,没有发布任何文档或这些函数的函数声明。

Microsoft has not published any documentation nor the function declarations of those functions as far as I know.

假设是通过一些使用<$ c $进行的快速测试c> hhc.exe 表示函数 HHA_CompileHHP 具有 BOOL 作为返回类型,其 int 并成功返回 TRUE ,即值 1 ,失败时 FALSE ,即值 0 。看起来 hhc.exe 使用此返回值而不将其值转换为退出/返回代码。

I suppose from some quick tests with hhc.exe that the function HHA_CompileHHP has BOOL as return type which is int and returns on success TRUE, i.e. the value 1, and on failure FALSE, i.e. the value 0. And it looks like hhc.exe uses this return value without inverting the value as exit/return code.

因此错误级别的 成功为 1 ,失败为 0

Therefore the errorlevel is 1 on success and 0 on failure.

为验证我的假设而进行的测试:

The tests I made to verify my assumption:


  1. 运行HTML帮助编译器,其项目文件名不存在:

  1. Run HTML Help compiler with name of a project file which does not exist:

hhc.exe index_1.hhp




无法打开index_1.hhp。

Unable to open index_1.hhp.

分别的退出代码错误级别为0。此错误消息由 hhc.exe ,因为可以在 hhc.exe 中找到错误消息。

The exit code respectively errorlevel is 0. This error message is printed by hhc.exe because the error message can be found in hhc.exe.

设置为只读已存在的输出文件 index.chm 上的文件属性,并运行HTML帮助编译器:

Set read-only file attribute on already existing output file index.chm and run HTML Help compiler:

attrib +r index.chm & hhc.exe index.hhp & attrib -r index.chm




HHC5010:错误:无法打开 C :...文件夹路径... index.chm。编译停止。

HHC5010: Error: Cannot open "C:... folder path ...\index.chm". Compilation stopped.

分别的退出代码错误级别为0。此错误消息由 hha.dll 打印,因为只能在 hha.dll 中找到此错误消息。

The exit code respectively errorlevel is 0. This error message is printed by hha.dll because this error message can be found only in hha.dll.

重命名在 index.hhp 中明确指定的* .htm文件,并运行HTML帮助编译器:

Rename a *.htm file explicitly specified in index.hhp and run HTML Help Compiler:

ren "file.htm" "renamed file.htm" & hhc.exe index.hhp & ren "renamed file.htm" "file.htm"




Microsoft HTML帮助编译器4.74.8702



编译C:...文件夹路径... \index.chm



HHC5003 :错误:编译 file.htm 时编译失败。



未编译以下文件:

file .htm

分别的退出代码错误级别为0。此错误消息也由 hha.dll 打印,因为此错误消息也只能在 hha.dll 中找到。

The exit code respectively errorlevel is 0. This error message is printed also by hha.dll because this error message can be found also only in hha.dll.

所有错误消息均写为处理 STDOUT 而不是 STDERR 作为控制台应用程序的典型值。除了$ 0或1以外,没有其他值分配给错误级别,这就是为什么我认为函数 HHA_CompileHHP 返回一个值的原因。简单的布尔值。

All error messages are written to handle STDOUT and not to STDERR as typical for console applications. There was never another value than 0 or 1 assigned to errorlevel which is the reason why I suppose the function HHA_CompileHHP returns a simple boolean value.

结论:

与通常情况相反例如通过在批处理文件中使用来评估HTML帮助编译的成功/失败:

The opposite as usual must be done to evaluate on success/failure of an HTML Help compilation for example by using in the batch file:

"%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" index.hhp
if not errorlevel 1 exit /B 1

[OPTIONS] 部分的HTML帮助项目文件(* .hhp文件)中,可以使用错误日志指定日志文件file = ... HHA_CompileHHP 输出的所有消息写入另外并将其打印到 STDOUT

In HTML Help Project file (*.hhp file) in section [OPTIONS] a log file can be specified with Error log file=... into which all messages output by HHA_CompileHHP are written additionally to printing them to STDOUT.

但是在这种情况下,使用 Doxygen 生成* .hhp文件,重定向 STDOUT ,将批处理文件中的日志文件尽管这并不是真正需要的,因为Team Foundation Server很可能已将消息捕获到日志中。 (我没有安装Team Foundation Server。)

But in this case with Doxygen generating the *.hhp file it would be easier to redirect STDOUT in the batch file to a log file although this is also not really needed because most likely the Team Foundation Server is capturing the messages already to a log. (I don't have Team Foundation Server installed.)

这篇关于HTML帮助研讨会成功编译.chm文件后返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆