⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch01.htm

📁 24小时学会vc++
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 1 -- Introducing Visual C++ 5</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1></CENTER><CENTER><P><A HREF="../fm/fm.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch02/ch02.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1><FONT COLOR="#000077">- Hour 1 -<BR>Introducing Visual C++ 5</FONT></H1></CENTER><P>Welcome to Hour 1 of <I>Teach Yourself Visual C++ 5 in 24 Hours</I>! Visual C++is an exciting subject, and this first hour gets you right into the basic featuresof the new Visual C++ 5 compiler and starts you off building some basic programs.</P><P>These are the highlights of this hour:<UL>	<LI>A short overview of the Visual C++ environment and how to work in it<BR>	<BR>		<LI>How to compile a simple console-mode program<BR>	<BR>		<LI>How to use AppWizard to create a Windows application</UL><H2><FONT COLOR="#000077"><B>Exploring Visual C++ 5</B></FONT></H2><P>Visual C++ 5 is the latest C++ compiler from Microsoft, continuing a long lineof Microsoft tools for Windows development. The Visual C++ package contains morethan a compiler; it also contains all the libraries, examples, and documentationneeded to create applications for Windows 95 and Windows NT.</P><P>Windows development tools have certainly come a long way since the earliest Cand C++ compilers for Windows. By combining into a single tool all the resourcesrequired to build Windows applications, Microsoft has made it much easier for youto learn to build applications.<H3><FONT COLOR="#000077"><B>The Visual C++ Environment</B></FONT></H3><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An <I>IDE</I>, or <I>IntegratedDevelopment Environment</I>, is a program that hosts the compiler, debugger, andapplication-building tools.</P><P>The central part of the Visual C++ package is <I>Developer Studio</I>, the IntegratedDevelopment Environment (IDE), shown in Figure 1.1. Developer Studio is used to integratethe development tools and the Visual C++ compiler. You can create a Windows program,scan through an impressive amount of online help, and debug a program without leavingDeveloper Studio.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 1.1.</B> </A><I><BR>Using Developer Studio to create a Windows program.</I></P><P>Visual C++ and Developer Studio make up a fully integrated environment that makesit very easy to create Windows programs. By using the tools and wizards providedas part of Developer Studio, along with the MFC class library, you can create a programin just a few minutes.</P><P>Many of the programs used as examples in this book require less than a page ofadditional source code. However, these programs use the thousands of lines of sourcecode that are part of the MFC class library. They also take advantage of AppWizardand ClassWizard, two of the Developer Studio tools that manage your project for you.<H3><FONT COLOR="#000077"><B>Developer Studio Tools</B></FONT></H3><P>Once upon a time, Windows programmers used simple text editors and tools thatwere hosted on MS-DOS to create their Windows programs. Developing a program underthose conditions was tedious and error-prone. Times have definitely changed; DeveloperStudio includes a number of tools that you might once have paid extra to purchase.<UL>	<LI>An integrated editor offers drag-and-drop and syntax highlighting as two of its	major features. You can configure the Developer Studio editor to emulate the keystroke	commands used by two popular programmer's editors, Brief and Epsilon.<BR>	<BR>		<LI>A resource editor is used to create Windows resources, such as bitmaps, icons,	dialog boxes, and menus.<BR>	<BR>		<LI>An integrated debugger enables you to run programs and check for errors. Because	the debugger is part of Developer Studio, it's easy to find and correct bugs. If	you find a programming error while debugging, you can correct the source code, recompile,	and restart the debugger.</UL><P>Developer Studio also features an online help system, which can be used to getcontext-sensitive help for all of the tools included in Developer Studio, as wellas detailed help on the C++ language, the Windows programming interface, and theMFC class library.<H3><FONT COLOR="#000077"><B>Developer Studio Wizards</B></FONT></H3><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>Wizard</I> is a toolthat helps guide you through a series of steps.</P><P>In addition to tools that are used for debugging, editing, and creating resources,Developer Studio includes several wizards that are used to simplify developing yourWindows programs. The most commonly used ones are<UL>	<LI><I>AppWizard</I> (also referred to in some screens as MFC AppWizard) is used	to create the basic outline of a Windows program. Three types of programs are supported	by AppWizard: single document and multiple document applications based on the Document/View	architecture and dialog box-based programs, in which a dialog box serves as the application's	main window. Later in this hour, you will use AppWizard to create a simple program.<BR>	<BR>		<LI><I>ClassWizard</I> is used to define the classes in a program created with AppWizard.	Using ClassWizard, you can add classes to your project. You can also add functions	that control how messages received by each class are handled. ClassWizard also helps	manage controls that are contained in dialog boxes by enabling you to associate an	MFC object or class member variable with each control. You will learn more about	ClassWizard in Hour 4, &quot;Dialog Boxes and C++ Classes.&quot;<BR>	<BR>		<LI><I>ActiveX ControlWizard</I> is used to create the basic framework of an ActiveX	control. An ActiveX control is a customized control that supports a defined set of	interfaces and is used as a reusable component. ActiveX controls replace Visual Basic	controls, or VBXs, which were used in 16-bit versions of Windows. ActiveX controls	are used in Hour 20, &quot;Using ActiveX Controls,&quot; and you will build an ActiveX	control in Hour 24, &quot;Creating ActiveX Controls.&quot;</UL><H3><FONT COLOR="#000077"><B>MFC Libraries</B></FONT></H3><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>library</I> is a collectionof source code or compiled code that you can reuse in your programs. Libraries areavailable from compiler vendors such as Microsoft, as well as from third parties.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>Visual C++ 5 includes Version5.0 of <I>MFC</I>, the Microsoft Foundation Classes, a class library that makes programmingfor Windows much easier.</P><P>By using the MFC classes when writing your programs for Windows, you can takeadvantage of a large amount of source code that has been written for you. This enablesyou to concentrate on the important parts of your code rather than worry about thedetails of Windows programming.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A recent addition to theC++ standard is the <I>Standard C++ Library</I>. This library includes a set of classesthat were known as the Standard Template Library, or STL, during the standardizationprocess. Unlike the MFC class library, which is used primarily for Windows programming,the standard C++ library is used for general-purpose programming.<H2><FONT COLOR="#000077"><B>Starting Developer Studio</B></FONT></H2><P>To start Developer Studio, click the Developer Studio icon located in the VisualC++ folder. To get to the Visual C++ folder, click the Start button on the taskbarand then select Programs. One of the items in the Programs folder is Microsoft VisualC++ 5.0. Figure 1.2 shows a start menu tree opened to the Microsoft Developer Studioicon.</P><P><A NAME="02"></A><A HREF="02.htm"><B>Figure 1.2.</B></A> <BR><I>Starting Developer Studio from the Start button.</I></P><P>Developer Studio initially displays two windows:<UL>	<LI>A Project Workspace window located on the left side; this window contains a table	of online help contents<BR>	<BR>		<LI>A Document window on the right side; this window contains the documentation home	page</UL><P>Developer Studio also includes a rich set of menus, toolbars, and other user interfacefeatures, as shown in Figure 1.3.</P><P><A NAME="03"></A><A HREF="03.htm"><B>Figure 1.3.</B> </A><BR><I>Developer Studio when first started.</I><H3><FONT COLOR="#000077"><B>Exploring InfoViewer</B></FONT></H3><P>InfoViewer is the online help system integrated into Developer Studio. InfoVieweris also compatible with the Microsoft Developer Network CD-ROM, enabling you to searchthat database for information.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>Usually, the indexes	used by the InfoViewer are copied to your hard disk and the actual database remains	on the CD-ROM. If you would like to speed up InfoViewer, run Visual C++ setup again	and install InfoViewer to the hard disk. <HR></BLOCKQUOTE><H4><FONT COLOR="#000077">Using Dockable Windows in Developer Studio</FONT></H4><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>Many of the views displayedby Developer Studio are <I>dockable</I>, which means they can be attached to theedge of the Developer Studio workspace, where they remain until undocked.</P><P>The Project Workspace window shown in Figure 1.3 is an example of a dockable view.To &quot;undock&quot; a dockable window, double-click the window's edge. To docka floating window, move it to the edge of the workspace. If it is a dockable window,it docks itself. If you want to move a dockable window close to the edge of a workspacewithout docking, press the Ctrl key on the keyboard when moving the window.<H4><FONT COLOR="#000077">Getting Context-Sensitive Help</FONT></H4><P>To get context-sensitive help from InfoViewer, press F1. You select a topic basedon the current window and cursor position, and you see the InfoViewer window, containingcontext-sensitive help. If you press F1 while editing a source file, help is providedfor the word under the cursor. If there is more than one possible help topic, yousee a list of choices.<H3><FONT COLOR="#000077"><B>The Visual C++ Editor</B></FONT></H3><P>Developer Studio includes a sophisticated editor as one of its tools. The editoris integrated with the other parts of Developer Studio; files are edited in a DeveloperStudio child window.</P><P>You use the Developer Studio editor to edit C++ source files that will be compiledinto Windows programs. The editor supplied with Developer Studio is similar to aword processor, but instead of fancy text-formatting features, it has features thatmake it easy to write source code.</P><P>You can use almost any editor to write C++ source code, but there are severalreasons to consider using the editor integrated with Developer Studio. The editorincludes many features that are found in specialized programming editors.<UL>	<LI>Automatic syntax highlighting colors keywords, comments, and other source code	in different colors.<BR>	<BR>		<LI>Automatic &quot;smart&quot; indenting helps line up your code into easy-to-read	columns.<BR>	<BR>		<LI>Emulation for keystrokes used by other editors helps if you are familiar with	editors such as Brief and Epsilon.<BR>	<BR>		<LI>Integrated keyword help enables you to get help on any keyword, MFC class, or	Windows function just by pressing F1.<BR>	<BR>		<LI>Drag-and-drop editing enables you to move text easily by dragging it with the	mouse.<BR>	<BR>		<LI>Integration with the compiler's error output helps you step through the list	of errors reported by the compiler and positions the cursor at every error. This	enables you to make corrections easily without leaving Developer Studio.</UL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -