在 MFC 中将 CFrameWnd 更改为 CFrameWndEx 会导致未处理的异常 - 有什么想法吗?
仍在适应这个 MFC 百灵鸟,我在这个特定问题上遇到了困难。我正在更新一些旧代码以使用 MFC 功能包中提供的一些更精致的控件。
按照网上给出的更新旧 MFC 应用程序的示例,将应用程序基类更改为 CWinAppEx 效果很好,但是当我将 CFrameWnd 更改为 CFrameWndEx 时,我收到来自 mfc90d.dll!AFXGetRegPath 中某处的“调试断言失败”错误消息。忽略此消息会导致出现大量 0xC0000005:访问冲突错误。
对于如何解决此问题的任何建议,我将不胜感激。
干杯。
Still getting used to this MFC lark and I've hit a brick wall on this particular problem. I'm updating some legacy code to use some of the more refined controls available in the MFC Feature Pack.
Following the examples given online for updating an old MFC app, changing the base application class to CWinAppEx works fine, but when I change CFrameWnd to CFrameWndEx, I get a Debug Assert Failed error message that comes from somewhere in mfc90d.dll!AFXGetRegPath. Ignoring this message leads to a slew of 0xC0000005: Access violation errors.
I'd be grateful for any suggestions on how to go about fixing this.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MFC 框架的源代码作为 Visual Studio 的一部分包含在内,因此应将其安装在您的计算机上。一般来说,当框架触发调试断言时,您应该进入调试器,这将帮助您确定问题的确切原因。
查看源代码,我可以看到
AFXGetRegPath
函数包含一些断言:如果我不得不猜测,我会说可能是
m_pszRegistryKey
检查失败了因为您没有在应用类的InitInstance
函数中调用SetRegistryKey
。我希望这有帮助!
The source code for the MFC framework is included as part of Visual Studio, so it should be installed on your computer. In general, when the framework triggers a debug assertion you should drop into the debugger and this will help you determine the exact cause of the problem.
Looking at the source code, I can see that the
AFXGetRegPath
function contains a few assertions:If I had to guess I'd say that it's the
m_pszRegistryKey
check that's failing, probably because you don't callSetRegistryKey
in your app class'sInitInstance
function.I hope this helps!