Visual C++ MFC application crashed when buttons clicked.

I have created a program called “Test.exe” created using Visual C++ 6.0 Professional. The program is a simple dialog MFC application, uses the serial port (MSCOMM) and is a debug build.
The program has been reliable for several years but only runs on a PC that has Visual C++ installed on it.
The program will crash when I click on any of the application's button on all other machines (ones without Visual C++ 6.0).
The program will run on a PC that has had Visual C++ installed on it and then removed.
“Dependency walker”
I have tried Microsoft Visual C++ 6 Professional’s dependency walker.
I copied the files that the “dependency walker” stated were needed on to the failing PC.
The application continues to crash as described.
I installed “Vcredist.exe” on to the failing PC.  
The application continues to crash as described.

What is needed for my program to work (other than installing Visual C++)?
I suspect the MSCOMM control or other OCX dependency. How would I resolve?
Who is Participating?
ZoppoConnect With a Mentor Commented:

I think best is to make a Release build in order to use it on computers where VC++ isn't installed - then you could either decide to use 'vcredist' to install needed DLLs on the target machine or you could even create a build which statically links to MFC so no DLLs are needed at all, only the resulting EXE.

AndyAinscowFreelance programmer / ConsultantCommented:
>>The program will crash when I click on any of the  application's button on all other machines (ones without Visual C++  6.0).

You should be distributing a release build (as previously said).  
You will find you are not allowed to distribute the debug versions of the MFC dll's with your app if you check your licence agreement.

I note however that your comment indicates your app actually runs on other machines - so you must already be distributing a release build (or a debug build with the debug versions of the dll's).

Does the crash happen for each button or just for one or two buttons ?
Do you get any error message ?
AndyAinscowFreelance programmer / ConsultantCommented:
Yes, but the removal should also remove the (debug) dll's
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

AndyAinscowFreelance programmer / ConsultantCommented:
>>The Test  MFC application has encountered a problem and needs to close.  We are sorry for the inconvenience

For completeness and to make certain I understand the situation correctly.
Your app will start on the other machine, you see the main window.  You then click on ANY button and the message above is shown and the app exits.
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
Oh, I hope there is actually more than one button on the dialog (and that these buttons do very diifferent things when clicked - not just call the same function but with a different parameter).
I suggest that you take the time to read me correctly.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.