VC++ 7 Tips

I’ve been using Visual C++ 7 (VC) Standard (aka .NET 2002) pretty much since its final release in February 2002.  There are lots of cool things with the Visual Studio (VS) 7 suite, which seem to be comprehensively talked about by Microsoft and advocators of VS 7.  However, as a VC++ with MFC developer, using it pretty much every day, I’ve come to see VC++7 as somewhat less than the hype would have you believe.

Here’s a few of the problems I’ve faced (and some solutions).  I should note that a lot of these are detailed within the MSDN itself.


Getting the MSDN help system OUT of the VC IDE

By default, when you first install VS or VC and try loading the MSDN help (assuming you’ve installed it) it will load within the IDE rather than opening a separate window.  This isn’t too major a problem, but here’s how you turn it off:

  1. Go to Help-’Short Start Page’ menu option.
  2. Click on the ‘My Profile’ tab
  3. Change the ‘Show Help’ radio button from Internal Help to External Help

One thing you may find more annoying than having the help within the IDE is that when using the help externally, occasionally a ‘Dynamic Help’ sub-window will still load in the IDE, instead of the external help window. I guess this is just a simple bug.


Adding functions to classes stored in the directory above your solution

This problem occurs if you have a project in d:\mydev\WidgetApp\ and you add some class files in the d:\mydev directory (you may do this if you have common classes, for instance).

If you try adding a new function to a class called CMyUtils which has its .cpp and .h file in d:\mydev, a new (empty) file, called myutils.cpp will be created in the d:\mydev\WidgetApp diretcory.

You’ll notice in the ‘Add Member Function Wizard’ dialog (IE when you click ‘Add Function’) shows you the .cpp file of the class. By changing this to the exact location of the .cpp file, you make sure VC adds the function to the correct file, rather than creating a new one.  For instance, if the box says myutils.cpp, you should change it to d:\mydev\myutils.cpp.


How do I get to my Project’s properties?

If you have a class or function selected in the class tree then the ‘Project’ menu changes accordingly. To get to the properties menu option, click on your project’s name (parent of the classes) and then go to the Project-Properties menu.


How do I turn off repetitive warnings?

Firstly - warnings are there for a reason, it’s far better to fix them, rather than turn them off.

What you need to do is find out the warning number, displayed as “Cxxxx” on the warning line in the Output window. This would be 4244 for an warning like:

\myfile.cpp(1074) : warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data

The best idea is to wrap the following lines around the code you want to ignore the warning for. DON’T turn it off for the entire source tree.

#pragma warning( disable : 4244)

double d=12.5;

int i = d; // This line causes warning

#pragma warning( default : 4244)

The pragma lines can be inside or outside function braces.


That’s all for now!  I’ll add some stuff about finding all the stuff VC7 made more difficult (IMHO) by getting rid of ClassWizard.


Was this useful? (5 = best)  1   2   3   4   5