亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch13.htm

?? 21天學(xué)會(huì)VC的英文版
?? HTM
?? 第 1 頁 / 共 5 頁
字號(hào):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"><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 += '</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="/includes/stylesheets/ebooks.css">	<META NAME="GENERATOR" Content="Symantec Visual Page Mac 1.1.1">	<TITLE>Teach Yourself Visual C++ 6 in 21 Days -- Ch 13 -- Saving and Restoring Work--File Access</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><H1 ALIGN="CENTER"><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM"BORDER="0"><BR>Teach Yourself Visual C++ 6 in 21 Days</H1><CENTER><P><A HREF="../ch12/ch12.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch14/ch14.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><H1 ALIGN="CENTER">- 13 -<BR>Saving and Restoring Work--File Access</H1><H1></H1><UL>	<LI><A HREF="#Heading1">Serialization</A>	<UL>		<LI><A HREF="#Heading2">The CArchive and CFile Classes</A>		<LI><A HREF="#Heading3">The Serialize Function</A>		<LI><A HREF="#Heading4">Making Objects Serializable</A>		<LI><A HREF="#Heading5">Listing 13.3. Including the IMPLEMENT_SERIAL macro in the		class implementation.</A>	</UL>	<LI><A HREF="#Heading6">Implementing a Serializable Class</A>	<UL>		<LI><A HREF="#Heading7">Creating a Serialized Application</A>		<LI><A HREF="#Heading8">Creating a Serializable Class</A>		<LI><A HREF="#Heading9">Building Support in the Document Class</A>		<LI><A HREF="#Heading10">Adding Navigating and Editing Support in the View Class</A>	</UL>	<LI><A HREF="#Heading11">Summary</A>	<LI><A HREF="#Heading12">Q&amp;A</A>	<LI><A HREF="#Heading13">Workshop</A>	<UL>		<LI><A HREF="#Heading14">Quiz</A>	</UL></UL><P><HR SIZE="4"><BR>Most applications provide the user the option of saving what has been created. Thecreation can be a word-processing document, a spreadsheet, a drawing, or a set ofdata records. Today, you will explore how Visual C++ provides you with the meansto implement this functionality easily. Today, you will learn</P><P><UL>	<LI>How Visual C++ uses C++ streams to save information about your application	<P>	<LI>How to store your application data in binary files	<P>	<LI>How to make your application objects serializable	<P>	<LI>How you can store variables of differing data types into a single file</UL><H2><A NAME="Heading1"></A>Serialization</H2><P>There are two parts of serialization. When application data is stored on the systemdrive in the form of a file, it is called serialization. When the application stateis restored from the file, it is called deserialization. The combination of thesetwo parts makes up the serialization of application objects in Visual C++.</P><P><H3><A NAME="Heading2"></A>The CArchive and CFile Classes</H3><P>Serialization in Visual C++ applications is accomplished through the CArchiveclass. The CArchive class is designed to act as an input/output (I/O) stream fora CFile object, as shown in Figure 13.1. It uses C++ streams to enable efficientdata flow to and from the file that is the storage of the application data. The CArchiveclass cannot exist without a CFile class object to which it is attached.</P><P><A HREF="javascript:popUp('13fig01.gif')"><B>FIGURE 13.1.</B></A><B> </B><I>TheCArchive class stores application data in a CFile object.</I></P><P>The CArchive class can store data in a number of types of files, all of whichare descendants of the CFile class. By default, the AppWizard includes all the functionalityto create and open regular CFile objects for use with CArchive. If you want or needto work with one of these other file types, you might need to add additional codeto your application to enable the use of these different file types.</P><P><H3><A NAME="Heading3"></A>The Serialize Function</H3><P>The CArchive class is used in the Serialize function on the document and dataobjects in Visual C++ applications. When an application is reading or writing a file,the document object's Serialize function is called, passing the CArchive object thatis used to write to or read from the file. In the Serialize function, the typicallogic to follow is to determine whether the archive is being written to or read fromby calling the CArchive IsStoring or IsLoading functions. The return value from eitherof these two functions determines if your application needs to be writing to or readingfrom the CArchive class's I/O stream. A typical Serialize function in the view classlooks like Listing 13.1.</P><P><H4>LISTING 13.1. A TYPICAL Serialize FUNCTION.</H4><PRE> 1: void CAppDoc::Serialize(CArchive&amp; ar) 2: { 3:    // Is the archive being written to? 4:    if (ar.IsStoring()) 5:    { 6:       // Yes, write my variable 7:       ar &lt;&lt; m_MyVar; 8:    } 9:    else10:    {11:       // No, read my variable12:       ar &gt;&gt; m_MyVar;13:    }14: }</PRE><P>You can place a Serialize function in any classes you create so that you can calltheir Serialize function from the document Serialize function. If you place yourcustom objects into an object array, such as the CObArray that you used in your drawingapplication for the past three days, you can call the array's Serialize functionfrom the document's Serialize function. The object array will, in turn, call theSerialize function of any objects that have been stored in the array.</P><P><H3><A NAME="Heading4"></A>Making Objects Serializable</H3><P>When you created the CLine class on Day 10, &quot;Creating Single Document InterfaceApplications,&quot; you had to add two macros before you could save and restore yourdrawings. These two macros, DECLARE_SERIAL and IMPLEMENT_SERIAL, include functionalityin your classes that are necessary for the Serialize function to work correctly.</P><P><H4>Including the DECLARE_SERIAL Macro</H4><P>You must include the DECLARE_SERIAL macro in your class declaration, as shownin Listing 13.2. The DECLARE_SERIAL macro takes a single argument, the class name.This macro automatically adds to your class some standard function and operator declarationsthat are necessary for serialization to work correctly.</P><P><H4>LISTING 13.2. INCLUDING THE DECLARE_SERIAL MACRO IN THE CLASS DECLARATION.</H4><PRE>1: class CMyClass : public CObject2: {3:     DECLARE_SERIAL (CMyClass)4: public:5:     virtual void Serialize(CArchive &amp;ar);6:     CMyClass();7:     virtual ~CMyClass();</PRE><PRE>8: };</PRE><P><H4>Including the IMPLEMENT_SERIAL Macro</H4><P>You need to add the IMPLEMENT_SERIAL macro to the implementation of your class.This macro needs to appear outside any other class functions because it adds thecode for the class functions that were declared with the DECLARE_SERIAL macro.</P><P>The IMPLEMENT_SERIAL macro takes three arguments. The first argument is the classname, as in the DECLARE_SERIAL macro. The second argument is the name of the baseclass, from which your class is inherited. The third argument is a version numberthat can be used to determine whether a file is the correct version for reading intoyour application. The version number, which must be a positive number, should beincremented each time the serialization method of the class is changed in any waythat alters the data being written to or read from a file. A typical usage of theIMPLEMENT_SERIAL macro is provided in Listing 13.3.</P><P><H3><A NAME="Heading5"></A>Listing 13.3. Including the IMPLEMENT_SERIAL macro inthe class implementation.</H3><PRE> 1: // MyClass.cpp: implementation of the CMyClass class. 2: // 3: ////////////////////////////////////////////////////////////////////// 4:  5: #include &quot;stdafx.h&quot; 6: #include &quot;MyClass.h&quot; 7:  8: #ifdef _DEBUG 9: #undef THIS_FILE10: static char THIS_FILE[]=__FILE__;11: #define new DEBUG_NEW12: #endif13: 14: IMPLEMENT_SERIAL (CMyClass, CObject, 1)15: //////////////////////////////////////////////////////////////////////16: // Construction/Destruction17: //////////////////////////////////////////////////////////////////////18: 19: CMyClass::CMyClass()20: {21: }22: 23: CMyClass::~CMyClass()24: {</PRE><PRE>25: }</PRE><P><H4>Defining the Serialize Function</H4><P>Along with the two macros, you need to include a Serialize function in your class.This function should be declared as a void function with a single argument (CArchive&amp;ar), public access, and the virtual check box selected--producing the functiondeclaration in Listing 13.2. When you implement the Serialize function for your class,you typically use the same approach as that used in the document class, shown inListing 13.1, where you check to determine whether the file is being written to orread from.</P><P><H2><A NAME="Heading6"></A>Implementing a Serializable Class</H2><P>When you begin designing a new application, one of the first things you need todesign is how to store the data in the document class that your application willcreate and operate on. If you are creating a data-oriented application that collectssets of data from the user, much like a contact database application, how are yougoing to hold that data in the application memory? What if you are building a wordprocessor application--how are you going to hold the document being written in theapplication memory? Or a spreadsheet? Or a painting program? Or...you get the idea.</P><P>Once you determine how you are going to design the data structures on which yourapplication will operate, then you can determine how best to serialize your applicationand classes. If you are going to hold all data directly in the document class, allyou need to worry about is writing the data to and reading the data from the CArchiveobject in the document's Serialize function. If you are going to create your ownclass to hold your application data, you need to add the serialization functionalityto your data classes so that they can save and restore themselves.</P><P>In the application that you are going to build today, you will create a simple,flat-file database application that illustrates how you can combine a mixture ofdata types into a single data stream in the application serialization. Your applicationwill display a few fields of data, some of which are variable-length strings, andothers that are integer or boolean, and will save and restore them in a single datastream to and from the CArchive object.</P><P><H3><A NAME="Heading7"></A>Creating a Serialized Application</H3><P>You can create your own classes, which can also be serialized, for use in an SDIor MDI application. In short, any application that works with any sort of data, whethera database or a document, can be serialized. Now you will create a simple, flat-filedatabase application that you will serialize.</P><BLOCKQUOTE>	<P><HR><STRONG>NOTE:</STRONG> A flat-file database is one of the original types of databases. It	is a simple file-based database, with the records sequentially appended to the end	of the previous record. It has none of the fancy relational functionality that is	standard in most databases today. The database that you will build today is closer	to an old dBASE or Paradox database, without any indexes, than to databases such	as Access or SQL Server.<HR></BLOCKQUOTE><H4>Creating the Application Shell</H4><P>To get your application started, create a new AppWizard application. Give yourapplication a name, such as Serialize, and click OK to start the AppWizard.</P><P>In the AppWizard, select to create a single document style application using theDocument/View architecture. You can choose to include support for ActiveX controlsin the third AppWizard step, although it's not really necessary for the example thatyou will build.</P><P>In the fourth step, be sure to specify the file extension for the files that yourapplication will create and read. An example of a file extension that you might wantto use is ser for serialize or fdb for flat-file database.</P><P>In the sixth AppWizard step, you need to specify which base class to use for theapplication view class. For a description of the different base classes availablefor inheriting the view class from, refer to Day 10 in the section &quot;The Document/ViewArchitecture.&quot; For the sample application you are building, because it willbe a database application, you'll find it easiest to use CFormView as the base classfrom which your view class will be inherited. This enables you to use the dialogdesigner for your application view.</P><P>Once you finish making your way through the AppWizard and let the AppWizard createyour application shell, you will see a large window canvas in the dialog designeras if you had created a dialog-style application, only without the OK and Cancel

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美电影影音先锋| 国产精品一二三区| 欧美日韩国产小视频| 亚洲午夜在线电影| 制服丝袜av成人在线看| 精品一区二区在线看| 国产日韩欧美一区二区三区乱码 | 欧美精品色综合| 人禽交欧美网站| 国产亚洲成av人在线观看导航| 国产高清无密码一区二区三区| 国产精品素人视频| 色综合天天综合色综合av| 亚洲不卡av一区二区三区| 日韩一区二区免费电影| 国产精品99久久久| 一区二区三区四区激情| 91精品免费在线| 国产成人av福利| 亚洲一区二区三区四区中文字幕| 日韩欧美三级在线| 91免费国产视频网站| 亚洲成av人片观看| 日本一区二区三级电影在线观看 | 成人av资源下载| 亚洲一二三四区| 欧美变态tickle挠乳网站| 成人污污视频在线观看| 国产一区二区在线观看免费 | 欧美在线999| 紧缚捆绑精品一区二区| 最好看的中文字幕久久| 欧美一区二区三区白人| 99久久久国产精品| 久久国产三级精品| 夜夜揉揉日日人人青青一国产精品 | 国产一区二区三区四区五区美女 | 日韩伦理电影网| 日韩欧美国产三级电影视频| 色哟哟一区二区在线观看 | 视频一区视频二区中文| 国产欧美精品一区| 欧美一级欧美三级在线观看 | 天堂成人国产精品一区| 国产精品久久免费看| 欧美xxxxxxxx| 在线综合视频播放| 91一区二区三区在线观看| 老司机精品视频导航| 五月婷婷综合在线| 综合分类小说区另类春色亚洲小说欧美| 正在播放亚洲一区| 欧美日韩国产色站一区二区三区| 成人动漫av在线| 国产在线播精品第三| 美女www一区二区| 全国精品久久少妇| 五月天丁香久久| 亚洲成人你懂的| 亚洲中国最大av网站| 亚洲欧美另类在线| 国产精品短视频| 中文字幕在线观看不卡| 国产午夜精品理论片a级大结局| 日韩欧美国产综合在线一区二区三区| 欧美日韩免费观看一区二区三区| 91丨porny丨户外露出| 成人免费视频网站在线观看| 国产a视频精品免费观看| 美女爽到高潮91| 精品一区免费av| 国产麻豆视频精品| 精品亚洲免费视频| 国内精品免费**视频| 激情五月婷婷综合| 久久99久久99| 国产麻豆视频一区二区| 国产黑丝在线一区二区三区| 国产成人99久久亚洲综合精品| 国产精品一级片在线观看| 国产成人精品一区二区三区四区 | 天堂成人国产精品一区| 日韩高清中文字幕一区| 看国产成人h片视频| 国产在线一区二区| 成人免费视频caoporn| 成人av电影在线网| 一本久久综合亚洲鲁鲁五月天| 日本精品一区二区三区四区的功能| 91热门视频在线观看| 欧美三级韩国三级日本一级| 欧美人狂配大交3d怪物一区| 精品女同一区二区| 久久先锋影音av| 国产精品第13页| 亚洲成人一区二区在线观看| 麻豆久久一区二区| 国产v日产∨综合v精品视频| 不卡av在线网| 欧美性大战久久久久久久| 欧美一区二区三区日韩视频| 久久久久久久性| 亚洲精品自拍动漫在线| 亚洲成人免费观看| 国产综合一区二区| 色悠悠亚洲一区二区| 欧美一区二区黄| 国产欧美日韩另类一区| 亚洲一区二区视频| 狠狠狠色丁香婷婷综合激情 | 国产成a人亚洲| 在线免费观看一区| 26uuu亚洲综合色| 一区二区三区在线视频观看| 久久成人麻豆午夜电影| 91在线观看污| 欧美xxxxxxxx| 亚洲永久免费av| 国产成人av影院| 91精品婷婷国产综合久久性色| 久久男人中文字幕资源站| 一区二区三区精品在线| 国产高清无密码一区二区三区| 欧美熟乱第一页| 国产精品成人免费精品自在线观看| 亚洲成人午夜电影| 成人h精品动漫一区二区三区| 欧美日韩国产一区二区三区地区| 国产欧美视频一区二区| 日本欧美肥老太交大片| 91国产免费观看| 欧美国产1区2区| 免费在线观看精品| 欧美性大战久久久久久久蜜臀| 欧美国产精品一区二区三区| 久久精品国产精品亚洲精品 | 色综合色综合色综合色综合色综合 | 国产一区二区在线看| 欧美久久久一区| 一区精品在线播放| 国产麻豆精品95视频| 欧美疯狂做受xxxx富婆| 一区二区三区在线视频免费| 成人免费高清视频| 久久影音资源网| 麻豆视频观看网址久久| 91精品国产综合久久久蜜臀粉嫩| 一区二区三区欧美视频| 99精品欧美一区二区三区小说| 久久久久久久久99精品| 韩国av一区二区三区四区| 欧美精品日韩综合在线| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美日韩精品欧美日韩精品| 亚洲色图一区二区| 成人一级视频在线观看| 国产欧美日韩精品在线| 国产在线精品一区在线观看麻豆| 日韩欧美在线123| 视频一区视频二区中文字幕| 欧美网站一区二区| 亚洲网友自拍偷拍| 欧美日韩国产在线观看| 五月天国产精品| 日韩欧美中文字幕制服| 久久精品国产亚洲一区二区三区| 555www色欧美视频| 日韩福利电影在线| 日韩欧美成人一区二区| 精品一区免费av| 国产片一区二区三区| 99精品视频在线免费观看| 日韩理论片在线| 在线免费观看成人短视频| 丝袜脚交一区二区| 日韩一区二区免费在线电影| 加勒比av一区二区| 久久久99精品免费观看| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 国产日韩精品一区二区浪潮av| 国产黄色91视频| 国产精品国产a| 91精彩视频在线| 奇米色一区二区| 久久久综合视频| 色又黄又爽网站www久久| 午夜免费久久看| 久久久精品国产99久久精品芒果| 成人免费精品视频| 亚洲线精品一区二区三区| 日韩免费观看高清完整版在线观看| 国产在线麻豆精品观看| 亚洲欧美日韩国产一区二区三区 | 欧美色国产精品| 久久国产麻豆精品| 国产免费观看久久| 欧美日韩卡一卡二| 国产精品99久久久久| 一区二区三区在线视频观看| 日韩精品一区二区三区中文精品|