Developer Studio is a terrifically complex application, enabling you to manage your programming products in almost any way imaginable. Some features of Developer Studio are easy to use, once you know what they do. Others require sophisticated knowledge of programming and of the various tools that Developer Studio puts at your disposal. In this chapter, you get an introduction to some of the more useful advanced features of Developer Studio, with which you may not yet have had experience.
In these days of complex programs, reusability has become more than just a buzzword. It's become a survival technique for programmers who find themselves with the awesome task of creating hundreds of thousands of lines of working source code in a minimum amount of time. Component Gallery (Figure 29.1) is one way that Developer Studio helps support the concept of reusability. Component Gallery gives you instant access to everything from reusable classes and OLE controls to wizards. You can even create your own components and add them to Component Gallery. In fact, in its default installation, Developer Studio automatically adds a category to Component Gallery for new AppWizard applications that you create.
Figure 29.1 : Component Gallery organizes reusable components, including classes and OLE controls.
Suppose you have a dialog box that you use frequently in projects. You can create this dialog box just once, add it to Component Gallery, and then merge it into new projects whenever you need it. To see how this might work, follow these steps:
You can use Component Gallery to manage many other types of components, including those that you might get from a friend or buy from a third-party supplier. Component Gallery can add, delete, import, and edit components in a variety of ways, depending upon the type of component with which you're working. Take some time to experiment with Component Gallery, and you'll quickly see how easy it is to use. (Your Visual C++ online documentation contains more information on Component Gallery.)
AppWizard is a sensational tool for getting projects started quickly and easily. However, because of its general nature, AppWizard makes many assumptions about the way you want a new project created. Sometimes, you may need a special type of AppWizard project that isn't supported by the default AppWizard. If this special project is a one-time deal, you'd probably just go ahead and create the project by hand. However, if you need to use this custom project type again and again, you might want to consider creating a custom AppWizard.
You can create a custom AppWizard in three ways: using the existing AppWizard steps as a starting point, using an existing project as a starting point, or starting completely from scratch. However, no matter what method you choose, creating a custom AppWizard can be a complicated task, requiring that you understand and be able to write script files using the macros and commands provided by Visual C++ for this purpose. The creation of these script files is beyond the scope of this book. However, the following procedures will give you a general idea of how to create a custom AppWizard.
After you've completed the preceding steps, your custom AppWizard project is ready for you to add the custom code needed to create the wizard. As you can see in Figure 29.9, the new project looks a lot like any other project you might create with Developer Studio, except that it contains some file types with which you may not yet be familiar.
Figure 29.9 : A custom AppWizard project workspace is much like other workspaces you've used.
The classes that end with "Dlg" are the classes that represent the dialog boxes that'll appear for each step of the wizard. You need to use the resource editor to customize the dialog-box objects that are associated with each of the classes. As mentioned previously, there are also script files-CONFIRM.INF and NEWPROJ.INF-that you must customize to create the wizard's steps.
When you compile the custom AppWizard, Developer Studio creates the final files and stores them in your Msdev\Template directory. The next time you choose to start a new project workspace, your custom AppWizard will be listed in the project types (Figure 29.10). To remove the custom AppWizard, delete the wizard's .awx and .pdb files from your Msdev\Template directory.
When you first install Visual C++, it supplies a set of default tools that you can use to help manage and create your programs. These tools include Spy++, MFC Tracer, OLE Control Test Container, and others. Although these tools are handy, you'll undoubtedly run into other tools that you might like to add to your Visual C++ programming environment. Suppose, for example, that you want to install WordPad as an editor on your Tool menu. You'd just follow the procedure given here:
You can purchase many additional tools from software vendors, not the least of which includes Microsoft's Visual SourceSafe-a project version-control manager-and VisualTest-a program-test automator. Other tools you might like to add include sophisticated source-code editors and debugging utilities.
The type of text editor you like is often a product of your experience. That is, once you've learned one way of doing things, you tend to be resistant to change. Previously, you learned that you can add your text editor of choice to Developer Studio's Tools menu. In addition, Developer Studio's built-in editor is capable of emulating two text editors: BRIEF and Epsilon. The text editor can also act like the text editor that came with Visual C++ 2.0. If you want to use the built-in editor, you should experiment with these various emulations to find the one that best suits your working habits. To set editor options, including emulation, follow these steps:
As most programmers know, the size and speed of a program are inversely proportional. That is, making a program faster often also makes it larger. Conversely, making a program smaller often also makes it run slower. Just as you're presented with these types of choices as you're creating the source code for your application, so too is the compiler forced to decide between different ways of producing executable code. By setting different optimization options, you can tell the compiler whether you want fast or slow code.
To find the optimization options, select the Build, Settings command
from Developer Studio's menu bar. (You must have a project open
in order to enable the Settings command. The settings are specific
to the current project.) When you do, the Project Settings property
sheet appears. Go to the C/C++ page and select Optimizations in
the Category box. As you can see by examining the Optimizations
box, Developer Studio defaults to no optimization. To select a
type of optimization, just choose from the drop-down list, as
shown in Figure 29.19.
Figure 29.19 : Select from the list the type of optimization that you want.
NOTE |
If you select the Customize option in the Optimizations box, you can select from the list of individual optimizations, including Assume No Aliasing, Global Optimizations, Favor Fast Code, Generate Intrinsic Functions, Frame-Pointer Omission, and more. However, as you can tell from the names of these optimizations, you really have to know what you're doing to set up a custom optimization scheme. |
This chapter only touched upon the many advanced features you can discover in Developer Studio. Your Visual C++ online documentation contains a wealth of information about the features covered in this chapter and about many other features not mentioned here. The more you become familiar with Developer Studio's many advanced features, the better you'll understand the program-creation process.
For more information on related topics, please refer to the following chapters: