简体   繁体   English

HtmlHelp()关闭我的MFC应用程序

[英]HtmlHelp() closes my MFC application

I am updating an old MFC application that used WinHelp so that it now uses HtmlHelp. 我正在更新使用WinHelp的旧MFC应用程序,以便它现在使用HtmlHelp。 I've changed the constructor of CWinApp-based class so that it calls EnableHtmlHelp() . 我更改了基于CWinApp的类的构造函数,以使其调用EnableHtmlHelp() Then I've changed the old calls from WinHelp( IDH_CONTENTS, HELP_CONTEXT) to HtmlHelp( IDH_CONTENTS, HH_HELP_CONTEXT) . 然后,我将以前的调用从WinHelp( IDH_CONTENTS, HELP_CONTEXT)更改为HtmlHelp( IDH_CONTENTS, HH_HELP_CONTEXT) Unfortunately, whenever I try to open the help from my application, I see the help window appear and then it and my application immediately close. 不幸的是,每当我尝试从应用程序中打开帮助时,都会看到帮助窗口出现,然后它和我的应用程序立即关闭。 If I step through the code line-by-line, the help file appears and stays visible. 如果我逐行浏览代码,则帮助文件将出现并保持可见状态。 Does anybody have any idea what's happening here and how I can fix it? 是否有人知道这里发生了什么以及如何解决? Thanks. 谢谢。

Ok. 好。 I found it. 我找到了。 I finally paid attention to this statement in the MSDN documentation: 我终于注意到了MSDN文档中的这一声明:

When using the HTML Help API, set the stack size of the hosting executable to at least 100k. 使用HTML帮助API时,将托管可执行文件的堆栈大小设置为至少100k。 If the defined stack size is too small, then the thread created to run HTML Help will also be created with this stack size, and failure could result. 如果定义的堆栈大小太小,则还将创建具有该堆栈大小的运行HTML帮助的线程,并且可能导致失败。

I changed my project settings to remove the Stack Reserve Size and now the help opens correctly. 我更改了项目设置以删除堆栈保留大小,现在可以正确打开帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM