Click here to Skip to main content
15,938,446 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have ported an MFC application in VS 2010 from VS 2006 which works fine on my computer as I have VS 2010 on my computer but it doesn't work properly on some computers. My application stops working on some button clicks. Release build works on some computers but it doesn't work on all computers.
Problem : When I click on a button my application crashes and this error message shows " MFC application has stopped working" (with loading bar)
My previous application from VS 2006 works fine on all PC but VS 2010 version have problems.

What I have tried:

1.I tried installing Redistributable vc++ 2010 but not working.
2. Installed .NET Framework 4.5
3. Reinstalled application.
4. Gave admin rights,Installed as administrator.
5. Tried building x64 and x86 versions
6. Tried to debug the code under the button by using messagebox but no use.
Posted
Updated 21-Dec-19 0:31am
v2
Comments
[no name] 21-Dec-19 8:12am    
You should specify what the code which crashes does
[no name] 21-Dec-19 8:23am    
Read also this /NXCOMPAT (Compatible with Data Execution Prevention) | Microsoft Docs[^]
and this MFC Application crashes after migrating from VC++6 to VS2010.[^]

[Edit]
And btw, google for "mfc vs2010 application crashes the application stopped working" gives tons of results. Looks like you are not alone with that problem.
Dave Kreskowiak 21-Dec-19 11:57am    
You keep saying "VS 2006". There's no such thing. The closest versions to that are 2005 and 2008.
Member 14630688 26-Dec-19 0:31am    
This is the code where my application crashes. I have tried debugging this code but it works perfectly fine on my pc


void CPDncView::OnAbortall()
{

int iRet=AfxMessageBox("Are you sure you want to abort all machines",MB_YESNOCANCEL);
if(iRet==IDNO)
return;
if(iRet==IDCANCEL)
return;

int prevActChan = iActiveChannel ;

for (int j = 0 ; j <= 16; j++ )
{
iActiveChannel = j;
sio_AbortWrite(objChannelInfo[iActiveChannel].iPortNo);
if (objChannelInfo[iActiveChannel].bChannelStatus==_FREE)
continue;
objChannelInfo[iActiveChannel].bAbort = TRUE;
bExitFlag[iActiveChannel]=objChannelInfo[iActiveChannel].bChannelStatus=_FREE;
objChannelInfo[iActiveChannel].iTranRece = 0;
int i = SetEvent(hEvent[iActiveChannel]);
sio_AbortRead(objChannelInfo[iActiveChannel].iPortNo);
bDirect = FALSE;
//arDirect[iActiveChannel]=0;
::Sleep(1000);
//objChannelInfo[iActiveChannel].im_direct = 0;
}
iActiveChannel = prevActChan ;

}

It is a reasonable guess that your application needs much more testing before release. The first thing you need to do is to find out where the failures occur, and what causes them. Adding some decent exception handling and logging would possibly help.

In terms of your list of things you have done:
1. What does "not working" mean?
2. MFC programs do not require the .NET framework.
3. Without knowing what the problem is, a re-install rarely makes a difference
4. Unless your app is designed to use administrator privileges, this is unlikely to make any difference.
5. Building x64 and x86 versions, only makes a difference if you know that there is a platform compatibility problem.
 
Share this answer
 
Comments
Member 14630688 21-Dec-19 6:06am    
There is a button after clicking on it my application crashes. "MFC application have stop responding" this error I get. Actually this application was built in VS2006 which runs perfectly on that computer. I ported my project to VS 2010. It was successfully built. Even I tried to debug the problem with the code under that button but it didn't give much information. The same button of the VS2006 project works fine on that computer. It is a WIN32 application which runs well on my PC. I also tested many other computers in my office and It works perfect but on that particular PC,that application crashes. I guess some Microsoft Visual Studio plugins are missing
Richard MacCutchan 21-Dec-19 9:17am    
The only way to find out is by debugging the application to find out where the crash happens, and what is the cause.
Dave Kreskowiak 21-Dec-19 11:58am    
Your app doesn't depend on anything Visual Studio related. There are no "plugins" your app is missing.
Member 14630688 26-Dec-19 0:31am    
This is the code where my application crashes. I have tried debugging this code but it works perfectly fine on my pc


void CPDncView::OnAbortall()
{

int iRet=AfxMessageBox("Are you sure you want to abort all machines",MB_YESNOCANCEL);
if(iRet==IDNO)
return;
if(iRet==IDCANCEL)
return;

int prevActChan = iActiveChannel ;

for (int j = 0 ; j <= 16; j++ )
{
iActiveChannel = j;
sio_AbortWrite(objChannelInfo[iActiveChannel].iPortNo);
if (objChannelInfo[iActiveChannel].bChannelStatus==_FREE)
continue;
objChannelInfo[iActiveChannel].bAbort = TRUE;
bExitFlag[iActiveChannel]=objChannelInfo[iActiveChannel].bChannelStatus=_FREE;
objChannelInfo[iActiveChannel].iTranRece = 0;
int i = SetEvent(hEvent[iActiveChannel]);
sio_AbortRead(objChannelInfo[iActiveChannel].iPortNo);
bDirect = FALSE;
//arDirect[iActiveChannel]=0;
::Sleep(1000);
//objChannelInfo[iActiveChannel].im_direct = 0;
}
iActiveChannel = prevActChan ;

}
Richard MacCutchan 26-Dec-19 7:07am    
Sorry, but I have no idea what that code is supposed to do, or what are the correct values of any variables, or indeed, which line cause the crash. You need to add some logging statements to capture more details when it is run on a system that causes the crash.
Use a tool like Dependency Walker to check if there are any missing dll's, see: 5 Tools to Check Dependency Files Needed by Application • Raymond.CC[^]

Or maybe you can try a cross-platform toolkit like this one: dear-imgui[^]
 
Share this answer
 
v2

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