Recently i have ported my c++ mfc application from VC++6 to VS2010. After resolving warning and few corrections, application is running and able to open all dialogs. But it crashes after clicking on the command buttons, combo boxes etc. Please let me know what could be the reason for this behaviour.
Thanks in Advance,
One of the differences between VC6 and VS2010 is in DEP compatibility. Everything from VS2005 and above creates DEP compatible code. If your code is relying on older libraries that aren't DEP compatible and your freshly compiled code is DEP compatible then you are going to have weird random crashes.
If you want to check that DEP compatibility might be the problem them use the editbin utility to remove DEP checking
editbin /NXCOMPAT:NO Your.exe
In your question you give too little detail for a good diagnosis.
As a first step I would recommend that you build your project in Debug configuration and start it in the debugger. Then reproduce the crash and probably you will see in the debugger what is happening. Most likely one of the many ASSERT statements in MFC will already alert you about the cause of the problem. If not, you could then give much more precise details about the crash and most likely get help here on this forum.
If you want to put on more details, please use the "improve question" button below your question and DO NOT paste it as a solution.
Don't want to get familiar with the debugger? -- You will have to, if you want to survive in this industry.
I've been tasked with migrating a few big applications from VC6 to 2008/2010 in the past.
I found it easier to generate fresh new projects and to migrate the code to them. I started doing this after wasting a week trying to understand why these projects crashed after simply upgrading them.
After the process was finished, I was unable to pin down why the upgrade produced crashing applications and the migrated apps didn't, though my suspicion falls on the manifest system and perhaps some old linkages left behind.
I've given this advice in the past and have been told it's too much work and the person asking just didn't want to do this.
I'm fine with that.
Let us know how this works out for you.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)