📄 chxb.htm
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Visual C++ 5 - Appendix B</TITLE>
<LINK REL="Next" HREF="chxc.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/chxc.htm">
<LINK REL="Previous" HREF="chxa.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/chxa.htm"></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><B>Appendix B</B></H2>
<H2><A ID="I1" NAME="I1"><B>The Developer Studio User Interface</B></A></H2>
<hr>
<P>When you buy Microsoft Visual C++, you actually get Microsoft Developer Studio with the Visual C++ component activated. Developer Studio is far more than just a compiler, and you have far more to learn than you may think. The interface is very visual,
which means that there are many possibilities greeting you when you first run Visual C++.</P>
<ul>
<li> <B>The components of Developer Studio</B></P>
<P> Developer Studio is more than just a compiler.</P>
<li> <B>The project workspace window</B></P>
<P> This tabbed window makes it simple and fast to access any part of your application.</P>
<li> <B>The Info view</B></P>
<P> Find your way around Books Online.</P>
<li> <B>The Resource view</B></P>
<P> Access your menus, dialog boxes, bitmaps, and other user interface resources.</P>
<li> <B>The Class view</B></P>
<P> See all your classes, and their variables and functions. See at a glance whether a variable is public or private, or double-click a function to jump to its source code.</P>
<li> <B>The File view</B></P>
<P> Organize your files and open them easily.</P>
<li> <B>The output window and status bar</B></P>
<P> At the bottom of the screen, these areas inform you and provide results.</P>
<li> <B>The code editor</B></P>
<P> This is where the real work gets done: you type in code, fix mistakes, and watch your application take shape.</P>
<li> <B>Developer Studio menus</B></P>
<P> You can reach Developer Studio commands through menu selections.</P>
<li> <B>Developer Studio toolbars</B></P>
<P> Once you’ve learned the basics, toolbars are a faster way to work.</P>
</ul>
<H3><A ID="I2" NAME="I2"><B>Reviewing Developer Studio: An Integrated Development Environment</B></A></H3>
<P>Microsoft Visual C++ is one component of the Microsoft Developer Studio. The capabilities of this one piece of software are astonishing. It is called an <I>integrated development environment</I> <I>(IDE)</I> because within a single tool, you can
perform the following:</P>
<ul>
<li> Read documentation and Books Online.</P>
<li> Generate starter applications without writing code.</P>
<li> View a project several different ways.</P>
<li> Edit source and include files.</P>
<li> Build the visual interface (menus and dialog boxes) of your application.</P>
<li> Compile and link.</P>
<li> Debug an application while it runs.</P>
</ul>
<P>Visual C++ is, technically speaking, just one component of Developer Studio. You can buy, for example, Microsoft's Visual J++ compiler and use it in Developer Studio as well. Looking at it another way, Visual C++ is more than just Developer Studio,
because the <I>Microsoft Foundation </I><I>Classes (MFC)</I> that are becoming the standard for C++ Windows programming are a class library and not related to the development environment. In fact, the major C++ compilers all use MFC now. However, for most
people, Visual C++ and Developer Studio mean the same thing, and in this book the names are used interchangeably.</P>
<H3><A ID="I3" NAME="I3"><B>Choosing a View</B></A></H3>
<P>The user interface of Developer Studio is very visual, encouraging you to move from view to view of your project: looking at your resources, classes, and files, or checking the online documentation. The main screen is divided into panes which you can
resize to suit your own needs. There are many shortcut menus, reached by right-clicking different places on the screen, to simplify common tasks.</P>
<P>With Visual C++, you work on a single application as a project. A <I>project</I> is a collection of files: source, headers, resources, settings, and configuration information. Developer Studio is designed to enable work on all aspects of a single
project at once. You create a new application by creating a new project. When you want to work on your application, you open the project (a file with the extension .dsw) rather than opening each code file independently. The interface of Developer Studio,
shown in Figures B.1 and B.2, is designed to work with a project and is divided into several zones.</P>
<A HREF="FFfig01.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/chxb/FFfig01.gif"><b>Fig. B.1</b></A>
<P><I>The Developer Studio interface presents a lot of information. The Project Workspace window is on the left.</I></P>
<A HREF="FFfig02.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/chxb/FFfig02.gif"><b>Fig. B.2</b></A>
<P><I>When the Project Workspace window is narrowed, the words on the tabs are replaced with icons.</I></P>
<P>The zones that make up the Developer Studio interface are as follows:</P>
<ul>
<li> Across the top: menus and toolbars. These are discussed in the second half of this chapter.</P>
<li> On the left: the Project Workspace window.</P>
<li> On the right: your main working area where you edit files or read documentation.</P>
<li> Across the bottom: the output window and status bar.</P>
</ul>
<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">
<P>Open Developer Studio and try to resize the panes and follow along as functions are described in this chapter.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<P>The Project Workspace window determines which way you look at your project, and what is in the main working area: documentation, code files, or resources (menus, icons, and dialog boxes). Each of these views is discussed in detail in a separate section
in this chapter, including the following:</P>
<ul>
<li> The InfoView is discussed in the "Looking at Documentation" section.</P>
<li> The ResourceView is discussed in the "Looking at Interface Elements" section.</P>
<li> The ClassView is discussed in the "Looking at Your Code, Arranged by Class" section.</P>
<li> The FileView is discussed in the "Looking at Your Code, Arranged by File" section.</P>
</ul>
<P>Developer Studio uses two different files to keep track of all the information about your project. The <I>project workspace file</I>, with a .dsw extension, contains the names of all the files in the project, what directories they are in, compiler and
linker options, and other information required by everyone who may work on the project. There is also a <I>project file</I>, with a .dsp extension, for each project within the workspace. <I>The workspace options file</I>, with a .opt extension, contains
all your personal settings for Developer Studio—colors, fonts, toolbars, which files are open and how their MDI windows are sized and located, breakpoints from your most recent debugging session, and so on. If someone else is going to work on your
project, you give that person a copy of the project workspace file and project file but not the project options file. </P>
<P>To open the project, open the project workspace file. The other files are opened automatically.</P>
<blockquote><p><img src="note.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/note.gif">
<P>Earlier versions of Visual C++ used .mdp files to store project information. When you open an old file, you are asked if it should be converted to the new format. The conversion process creates .dsw, .dsp, and .opt files for you and does not delete
your old files.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<H3><A ID="I4" NAME="I4"><B>Looking at Documentation</B></A></H3>
<P>When you first start Developer Studio and no project is open, the only tab in the Project Workspace window is the InfoView tab. When a project is open, there are other tabs to choose from. Clicking the InfoView tab brings a table of contents into the
Project Workspace window and an InfoViewer topic window into the main working area, as shown in Figures B.1 and B.2. The table of contents is an outline that can be expanded or collapsed. Double-clicking an entry in the table of contents displays that
entry in the InfoViewer topic window.</P>
<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">
<P>If your Project Workspace window is too narrow for reading the topic headings in the table of contents, you can scroll the window with the horizontal scroll bar. You can also pause the mouse cursor over any topic heading, and a small box like a ToolTip
appears showing the full heading for the topic.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<P>Within the InfoViewer topic window, documentation is displayed as hypertext. Words and phrases that are highlighted act as links; clicking a link displays different information. The documentation is written in HTML and is displayed just as it would be
in Microsoft Internet Explorer, the web browser from Microsoft. While most of the links lead to other help topics on your hard drive or CD, some of them lead out onto the Internet for the very latest information.</P>
<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">
<P>Your settings in Microsoft Internet Explorer affect how InfoViewer in Developer Studio displays documentation. For example, if you turn off image display in Explorer, images will not be displayed in InfoViewer until you click them.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<P>By default, the InfoViewer window is maximized to fill the entire working area, and the title bar of Developer Studio has InfoViewer Topic added to it. By clicking the Restore button under the main Restore button for all of Developer Studio, you can
arrange the InfoViewer MDI window within the main working area. This allows you to compare two help topics or a help topic and a piece of code. Figure B.3 shows the InfoViewer window restored. The topic window can also be minimized.</P>
<A HREF="FFfig03.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/chxb/FFfig03.gif"><b>Fig. B.3</b></A>
<P><I>The InfoViewer topic window does not have to be maximized.</I></P>
<P>Many InfoViewer commands are on the Help menu or the InfoViewer toolbar, both discussed in the second half of this chapter. There is a shortcut menu, reached by right-clicking anywhere within the InfoViewer topic window. As shown in Figure B.4, it
features commands that are commonly used when looking at a page of HTML in Microsoft Internet Explorer, and is not very useful while using Visual C++.</P>
<A HREF="FFfig04.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/chxb/FFfig04.gif"><b>Fig. B.4</b></A>
<P><I>The InfoViewer topic window has a number of shortcuts available on the right-click menu.</I></P>
<H3><A ID="I5" NAME="I5"><B>Looking at Interface Elements</B></A></H3>
<P>Clicking the ResourceView tab in the Project Workspace window brings up an expandable and collapsible outline of the visual elements of your program: accelerators, dialog boxes, icons, menus, the string table, toolbars, and version information. These
resources define the way users interact with your program. <A HREF="index02.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index02.htm" target="text">Chapter 2</A>, "Dialog Boxes and Controls;" <A HREF="index09.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index09.htm" target="text">Chapter 9</A>, “Building a Complete Application: ShowString;”
and <A HREF="index10.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index10.htm" target="text">Chapter 10</A>, “Status Bars and Toolbars” cover the work involved in creating and editing these resources. The next few sections cover the way in which you can look at completed resources.</P>
<blockquote><p><img src="tip.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/tip.gif">
<P>Open one of the projects on the CD that comes with this book, or a sample project from Visual C++, and follow along as functions are described in this section. Showstring, the sample application from <A HREF="index09.htm" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/index09.htm" target="text">Chapter 9</A>,
“Building a Complete Application: ShowString,” is a good choice since it uses most of the features described in this section.</P>
<p><img src="bottom.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/bottom.gif"></blockquote>
<P><A ID="I6" NAME="I6"><B>Accelerators</B></A></P>
<P>Accelerators<I> associate key combinations with menu items. Figure B.5 </I><I>shows an accelerator resource created by AppWizard. All of these </I><I>accelerator combinations are made for you when you create a new </I><I>application. You can add hot
keys for specific menu items, if necessary.</I></P>
<A HREF="FFfig05.gif" tppabs="http://www.mcp.com/814147200/0-7897/0-7897-1145-1/figs/chxb/FFfig05.gif"><b>Fig. B.5</b></A>
<P><I>Accelerators associate key combinations with menu items.</I></P>
<P><A ID="I7" NAME="I7"><B>Dialog Boxes</B></A></P>
<P>Dialog boxes<I> are the way your application gets information from users. </I><I>When a dialog resource is being displayed in the main working area, as </I><I>in Figure B.6, a control palette floats over the working area. (If it’s </I><I>not
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -