MFC CPP UNIT示例项目问题 [英] MFC CPP UNIT sample project problem

查看:77
本文介绍了MFC CPP UNIT示例项目问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个MFC客户端应用程序,用于使用CPP UNIT框架测试一些项目。

在我的客户端应用程序中,我想要CPP UNIT框架的MFC GUI组件这是Testrunner。

但是当我调用Testrunner的run()函数时,我的客户端应用程序崩溃了,而在调试时我发现它在AfxGetResourceHandle函数中崩溃了。



CPP UNIT提供的同样样本项目工作正常。



我不知道我哪里出错了。

任何人都可以帮我解决这个问题。



提前预付。

Hi
I am developing an MFC client application for testing some project using CPP UNIT framework.
In my client application I want to MFC GUI component of CPP UNIT framework which is Testrunner.
But when I call run() function of Testrunner my client application crashes and while debugging I found that It crashes in AfxGetResourceHandle function.

The same sample project provided by CPP UNIT is working fine.

I don't know where I m going wrong.
Can anyone please help me out in this problem.

Thatnk in advance.

推荐答案

这是可能是由于代码中的ASSERT,您可能只会在调试版本中看到这一点。您可能需要添加:



This is probably due to an ASSERT in the code, and you will likely see this only on debug builds. You probably need to add:

AFX_MANAGE_STATE(AfxGetStaticModuleState( ));


$ b在调用AfxGetResourceHandle()之前$ b

。向Google询问有关AFX_MANAGE_STATE的更多详情。



before you call AfxGetResourceHandle(). Ask Google about AFX_MANAGE_STATE for more details.


感谢Brydon的回复。

但这不是问题。

问题是由于字符集。

testrunner dll使用自动字符集,我的客户端应用程序使用UNICODE字符集。因此,当传递对话框名称为字符串testrunner时,无法解释名称,因为崩溃发生。

当我将我的字符集设置为未设置时,它工作正常。
Thanks Brydon for ur response.
But that is not the problem.
The problem was due to character set.
The testrunner dll was using auto char set and my client application uses UNICODE character set. So while passing dialog name as string testrunner can't interpret the name as a result crash occurs.
When I change my char set to "Not set ", it is working fine.


这篇关于MFC CPP UNIT示例项目问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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