Click here to Skip to main content
15,742,231 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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.
KarstenK 12-Sep-13 5:14am    
some reosurces are missing. I guess some texts frm Tesrrunner. You need to include them in your project.
Rahul from Poona 12-Sep-13 6:51am    
How to do that. I have include testrunner.lib and its coressponding dll.

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( ));

before you call AfxGetResourceHandle(). Ask Google about AFX_MANAGE_STATE for more details.
Share this answer
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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900