Warning: This product compiles code which calls shared dlls - specifically msvcrt and mfc42. This means that to distribute your code, you will need to also distribute these dlls. As a result, your code will always be unreliable and simply installing it may cause a full and unrecoverable system failure.
MFC Warning
These Dr. Watson failures were traced to different versions of MFC42.dll. The program ran fine when Version 4.21.7303 was loaded, and failed (crashed) when Version 6.00.8447 was loaded.
Versions 6.00.8xxx are loaded with Windows 98 Second Edition, Windows 2000, Windows ME, Office 2000, FrontPage 2000, Visual Studio 6.0 SP3, and many other products. In addition, loading any C++ application which uses MFC and is compiled with Visual Studio 6.0 SP3 will install a new dll.
For information on which products install a specific dll version, see the Microsoft DLL Help database. Enter mfc42.dll as the filename.
I don't know if all the 6.0.8xxxx versions cause the problem, or if Microsoft decided to fix it, but this single design failure is enough to make me very leary of ever using MFC.
I mean, how can you design a product that will propably fail the next time someone adds new software to their machine?
Even more to the point, how can you design a product that will propably cause existing/working software on your client's machine to crash simply because your client loaded your software? (You can bet that you will get the blame, not M$.)
Notes
As usual, the provided help files were worthless. On the web, I found that page 5 of AppWizard and ClassWizard explained how to display the standard controls - buttons, edit fields, ...
The final solution was simple, simply right click in the toolbar area and enable Controls. Then you simply select the control you want and place it on the form.
Now the only problem is how to add code to a button. (In general, double clicking the button places the cursor at the correct point in the source file. But, on one form I was creating, nothing happened.)
When I started out, there was nothing "visual" about Microsoft's Visual C++ 6.0 product. All there was was a text editor.
If you wanted to design a form (a user interface) then you had to write code. This method of form design has been obsolete for 10 years.
Well, I thought I would get an example. In the Help, I selected Visual C++ Documentation and searched for Hello World - the 5 examples were grayed out! (Well, that's worthless.)
Well, I eventually found instructions indicating that I probably want to run the MFC wizard. Guess what, it is possible to statically link the MFC library and avoid the MFC DLL Hell I've seen so many times.
Boy, it takes a long time for the first compile - but subsequent compiles are instantaneous. The exe file is only 2 Meg. (Unbelievable for just 2 buttons - 15 meg for everything. Mfc42.lib alone is about 2 Meg.)
It is not obvious how to add additional buttons. Perhaps they are instances of CButton. But there are no examples. CButton is defined in afxwin.h (MFC) and derived from CWnd. A text property is defined under CWnd - use GetWindowText & SetWindowText. There does not appear to be a property for the button text.
The buttons appear to be defined in *.rc (resource file). Notice also that *.rc is the name of the displayed form. You would think that there would be a way to add another mfc component to the form. (With Visual Basic, Delphi, or almost any other modern development platform, this task is obvious. Find the button object on some palette and use it to create a button on the form. Simple. It would be hard for "Visual" C++ to make this more obscure.) It turned out that someone had turned off the palette - to see it, right click on the toolbar and enable Controls. Tools / Customize... / Toolbars can also be used to enable the pallet, but View / something would have made a lot more sense than View and it would have taken fewer days to find. (5 days is a lot :(
Using the Integreated Debugger
But for Visual C++ 6, Microsoft has a better idea,
Oh, yes - the built-in help is not half as clear as this. If you follow those instruction, you'll never get it to work. (That's right - they're wrong.)
If the icons are not visible, right click in the toolbar area and be sure that the Build MiniBar is visible. Also be sure to click on the line where you want the break point.
One great feature is that some of the variables in scope are displayed at the bottom of the screen. The variable which just changed is in red. You can also expand the currect class (this) and see all the current settings.
How to Display a Pointer as an Array
Moving an Existing Project to Visual C++
By the way, one of the great things about Visual C++ is the file index on the left hand side of the screen - just double click the file you want and it comes to the top.
MFC is compatible across the entire Windows familywhich is not exactly true. Newer versions of mfc are known to crash older projects. AppWizard and ClassWizard (page 5 explained how to display the standard controls - buttons, edit fields, ...)