开发者

Changing CFrameWnd to CFrameWndEx in MFC causes unhandled exception - any ideas?

Still getting used to this MFC lark and I开发者_StackOverflow'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.


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:

ENSURE(lpszPostFix != NULL);
ASSERT_VALID(pApp);
ENSURE(AfxGetApp()->m_pszRegistryKey != NULL);
ENSURE(AfxGetApp()->m_pszProfileName != NULL);

If I had to guess I'd say that it's the m_pszRegistryKey check that's failing, probably because you don't call SetRegistryKey in your app class's InitInstance function.

I hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜