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

📄 ch01.htm

📁 A very good resource on Visual C++ 6.0 environment. It teaches through step by step approach and fin
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
<SCRIPT LANGUAGE="JavaScript">

<!--

function popUp(pPage) {
 var fullURL = document.location;
 var textURL = fullURL.toString();
 var URLlen = textURL.length;
 var lenMinusPage = textURL.lastIndexOf("/");
 lenMinusPage += 1;
 var fullPath = textURL.substring(0,lenMinusPage);
 popUpWin = window.open('','popWin','resizable=yes,scrollbars=no,width=525,height=394');
 figDoc= popUpWin.document;
 zhtm= '<HTML><HEAD><TITLE>' + pPage + '</TITLE>';
 zhtm += '<link rel="stylesheet" href="/includes/stylesheets/ebooks.css"></head>';
 zhtm += '<BODY bgcolor="#FFFFFF">';
 zhtm += '<IMG SRC="' + fullPath + pPage + '">';
 zhtm += '<P><B>' + pPage + '</B>';
 zhtm += '</BODY></HTML>';
 window.popUpWin.document.write(zhtm);
 window.popUpWin.document.close();
 // Johnny Jackson 4/28/98
 }

//-->
                                                                
</SCRIPT>
<link rel="stylesheet" href="ebooks.css" tppabs="http://www.fintech.ru/includes/stylesheets/ebooks.css">

	
	<TITLE>Special Edition Using Visual C++ 6 -- Ch 1 -- Building Your First Windows Application</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<CENTER>
<H1><IMG SRC="que.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/que.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR>
Special Edition Using Visual C++ 6</H1>
</CENTER>
<CENTER>
<P><A HREF="fm.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/fm/fm.htm"><IMG SRC="previous.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="ch02.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/ch02/ch02.htm"><IMG
SRC="next.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="index.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/index.htm"><IMG SRC="contents.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> 
<HR>

</CENTER>
<CENTER>
<H1>- 1 -</H1>
</CENTER>
<CENTER>
<H1>Building Your First Windows Application</H1>
</CENTER>

<UL>
	<LI><A HREF="#Heading1">Creating a Windows Application</A>
	<UL>
		<LI><A HREF="#Heading2">Deciding How Many Documents the Application Supports</A>
		<LI><A HREF="#Heading3">Databases</A>
		<LI><A HREF="#Heading4">Compound Document Support</A>
		<LI><A HREF="#Heading5">Appearance and Other Options</A>
		<LI><A HREF="#Heading6">Other Options</A>
		<LI><A HREF="#Heading7">Filenames and Classnames</A>
		<LI><A HREF="#Heading8">Creating the Application</A>
		<LI><A HREF="#Heading9">Try It Yourself</A>
	</UL>
	<LI><A HREF="#Heading10">Creating a Dialog-Based Application</A>
	<LI><A HREF="#Heading11">Creating DLLs, Console Applications, and More</A>
	<UL>
		<LI><A HREF="#Heading12">ATL COM AppWizard</A>
		<LI><A HREF="#Heading13">Custom AppWizard</A>
		<LI><A HREF="#Heading14">Database Project</A>
		<LI><A HREF="#Heading15">DevStudio Add-In Wizard</A>
		<LI><A HREF="#Heading16">ISAPI Extension Wizard</A>
		<LI><A HREF="#Heading17">Makefile</A>
		<LI><A HREF="#Heading18">MFC ActiveX ControlWizard</A>
		<LI><A HREF="#Heading19">MFC AppWizard (DLL)</A>
		<LI><A HREF="#Heading20">Win32 Application</A>
		<LI><A HREF="#Heading21">Win32 Console Application</A>
		<LI><A HREF="#Heading22">Win32 Dynamic Link Library</A>
		<LI><A HREF="#Heading23">Win32 Static Library</A>
	</UL>
	<LI><A HREF="#Heading24">Changing Your AppWizard Decisions</A>
	<LI><A HREF="#Heading25">Understanding AppWizard's Code</A>
	<UL>
		<LI><A HREF="#Heading26">A Single Document Interface Application</A>
		<LI><A HREF="#Heading27">Other Files</A>
	</UL>
	<LI><A HREF="#Heading28">Understanding a Multiple Document Interface Application</A>
	<LI><A HREF="#Heading29">Understanding the Components of a Dialog-Based Application</A>
	<LI><A HREF="#Heading30">Reviewing AppWizard Decisions and This Chapter</A>
</UL>

<P>
<HR SIZE="4">

<CENTER>
<H1></H1>
</CENTER>
<H2><A NAME="Heading1"></A>Creating a Windows Application</H2>
<P>Visual C++ doesn't just compile code; it generates code. You can create a Windows
application in minutes with a tool called AppWizard. In this chapter you'll learn
how to tell AppWizard to make you a starter app with all the Windows boilerplate
code you want. AppWizard is a very effective tool. It copies into your application
the code that almost all Windows applications require. After all, you aren't the
first programmer to need an application with resizable edges, minimize and maximize
buttons, a File menu with Open, Close, Print Setup, Print, and Exit options, are
you?</P>
<P>AppWizard can make many kinds of applications, but what most people want, at least
at first, is an executable (.exe) program. Most people also want AppWizard to produce
boilerplate code--the classes, objects, and functions that have to be in every program.
To create a program like this, Choose File, New and click the Projects tab in the
New dialog box, as shown in Figure 1.1.</P>
<P><A HREF="javascript:popUp('01uvc01.gif')"><B>FIG. 1.1</B></A><B> </B><I>The Projects
tab of the New dialog box is where you choose the kind of application you want to
build.</I></P>
<P>Choose MFC AppWizard (EXE) from the list box on the left, fill in a project name,
and click OK. AppWizard will work through a number of steps. At each step, you make
a decision about what kind of application you want and then click Next. At any time,
you can click Back to return to a previous decision, Cancel to abandon the whole
process, Help for more details, or Finish to skip to the end and create the application
without answering any more questions (not recommended before the last step). The
following sections explain each step.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>NOTE:</strong> An MFC application uses MFC, the Microsoft Foundation Classes. You
	will learn more about MFC throughout this book.
<HR>


</BLOCKQUOTE>

<H3><A NAME="Heading2"></A>Deciding How Many Documents the Application Supports</H3>
<P>The first decision to communicate to AppWizard, as shown in Figure 1.2, is whether
your application should be MDI, SDI, or dialog based. AppWizard generates different
code and classes for each of these application types.</P>
<P><A HREF="javascript:popUp('01uvc02.gif')"><B>FIG. 1.2</B></A><B> </B><I>The first
step in building a typical application with AppWizard is choosing the interface.</I></P>
<P>The three application types to choose from are as follows:</P>

<UL>
	<LI>A <I>single document interface</I> (SDI) application, such as Notepad, has only
	one document open at a time. When you choose File, Open, the currently open file
	is closed before the new one is opened.
	<P>
	<LI>A <I>multiple document interface</I> (MDI) application, such as Excel or Word,
	can open many documents (typically files) at once. There is a Window menu and a Close
	item on the File menu. It's a quirk of MFC that if you like multiple views on a single
	document, you must build an MDI application.
	<P>
	<LI>A <I>dialog-based</I> application, such as the Character Map utility that comes
	with Windows and is shown in Figure 1.3, does not have a document at all. There are
	no menus. (If you'd like to see Character Map in action, it's usually in the Accessories
	folder, reached by clicking Start. You may need to install it by using Add/Remove
	programs under Control Panel.)
</UL>

<P><A HREF="javascript:popUp('01uvc03.gif')"><B>FIG. 1.3</B></A><B> </B><I>Character
Map is a dialog-based application.</I></P>
<P><I><BR>
</I>As you change the radio button selection, the picture on the left of the screen
changes to demonstrate how the application appears if you choose this type of application.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>NOTE::</strong> Dialog-based applications are quite different from MDI or SDI applications.
	The AppWizard dialogs are different when you're creating a dialog-based application.
	They are presented later in the section &quot;Creating a Dialog-Based Application.&quot;&#160;
	
<HR>


</BLOCKQUOTE>

<P>Beneath these choices is a checkbox for you to indicate whether you want support
for the Document/View architecture. This framework for your applications is explained
in Chapter 4, &quot;Documents and Views.&quot; Experienced Visual C++ developers,
especially those who are porting an application from another development system,
might choose to turn off this support. You should leave the option selected.</P>
<P>Lower on the screen is a drop-down box to select the language for your resources.
If you have set your system language to anything other than the default, English[United
States], make sure you set your resources to that language, too. If you don't, you
will encounter unexpected behavior from ClassWizard later. (Of course, if your application
is for users who will have their language set to U.S. English, you might not have
a choice. In that case, change your system language under Control Panel.) Click Next
after you make your choices.</P>
<P>
<H3><A NAME="Heading3"></A>Databases</H3>
<P>The second step in creating an executable Windows program with AppWizard is to
choose the level of database support, as shown in Figure 1.4.</P>
<P><A HREF="javascript:popUp('01uvc04.gif')"><B>FIG. 1.4</B></A><B> </B><I>The second
step to building a typical application with AppWizard is to set the database options
you will use.</I></P>
<P>There are four choices for database support:</P>

<UL>
	<LI>If you aren't writing a database application, choose None.
	<P>
	<LI>If you want to have access to a database but don't want to derive your view from
	CFormView or have a Record menu, choose Header Files Only.
	<P>
	<LI>If you want to derive your view from CFormView and have a Record menu but don't
	need to serialize a document, choose Database View Without File Support. You can
	update database records with CRecordset, an MFC class discussed in more detail in
	Chapter 22, &quot;Database Access.&quot;
	<P>
	<LI>If you want to support databases as in the previous option but also need to save
	a document on disk (perhaps some user options), choose Database View With File Support.
</UL>

<P>Chapter 22 clarifies these choices and demonstrates database programming with
MFC. If you choose to have a database view, you must specify a data source now. Click
the Data Source button to set this up.</P>
<P>As you select different radio buttons, the picture on the left changes to show
you the results of your choice. Click Next to move to the next step.</P>
<P>
<H3><A NAME="Heading4"></A>Compound Document Support</H3>
<P>The third step in running AppWizard to create an executable Windows program is
to decide on the amount of compound document support you want to include, as shown
in Figure 1.5. OLE (object linking and embedding) has been officially renamed ActiveX
to clarify the recent technology shifts, most of which are hidden from you by MFC.
ActiveX and OLE technology are jointly referred to as <I>compound document technology</I>.
Chapter 13, &quot;ActiveX Concepts,&quot; covers this technology in detail.</P>
<P><A HREF="javascript:popUp('01uvc05.gif')"><B>FIG. 1.5</B></A><B> </B><I>The third
step of building a typical application with AppWizard is to set the compound document
support you will need.</I></P>
<P>There are five choices for compound document support:</P>

<UL>
	<LI>If you are not writing an ActiveX application, choose None.
	<P>
	<LI>If you want your application to contain embedded or linked ActiveX objects, such
	as Word documents or Excel worksheets, choose Container. You learn to build an ActiveX
	container in Chapter 14, &quot;Building an ActiveX Container Application.&quot;
	<P>
	<LI>If you want your application to serve objects that can be embedded in other applications,
	but it never needs to run as a standalone application, choose Mini Server.
	<P>
	<LI>If your application serves documents and also functions as a standalone application,
	choose Full Server. In Chapter 15, &quot;Building an ActiveX Server Application,&quot;
	you learn to build an ActiveX full server.
	<P>
	<LI>If you want your application to have the capability to contain objects from other

⌨️ 快捷键说明

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