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

📄 192-196.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<td width="100%" valign="top" align="left">


<!-- END SUB HEADER -->

<!--Begin Content Column -->

<FONT FACE="Arial,Helvetica" SIZE="-1">
To access the contents, click the chapter and section titles.
</FONT>
<P>
<B>Essential Windows CE Application Programming</B>
<FONT SIZE="-1">
<BR>
<I>(Publisher: John Wiley & Sons, Inc.)</I>
<BR>
Author(s): Robert Burdick
<BR>
ISBN: 0471327476
<BR>
Publication Date: 03/01/99
</FONT>
<P>
<form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi">

<INPUT TYPE="hidden" NAME="Action" VALUE="Search">
<INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm">
<INPUT TYPE="hidden" NAME="Collection" VALUE="ITK">
<INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-simple-intrabook.hts">
<INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts">

<font face="arial, helvetica" size=2><b>Search this book:</b></font><br>
<INPUT NAME="queryText" size=50 VALUE="">&nbsp;<input type="submit" name="submitbutton" value="Go!">
<INPUT type=hidden NAME="section_on" VALUE="on">
<INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471327476/">

</form>


<!-- Empty Reference Subhead -->

<!--ISBN=0471327476//-->
<!--TITLE=Essential Windows CE Application Programming//-->
<!--AUTHOR=Robert Burdick//-->
<!--PUBLISHER=John Wiley & Sons, Inc.//-->
<!--IMPRINT=Wiley Computer Publishing//-->
<!--CHAPTER=7//-->
<!--PAGES=192-196//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="189-192.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="196-198.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>Windows CE provides a database application programming interface for creating and managing databases on Windows CE devices. This API provides functionality for the following database operations:
</P>
<DL>
<DD><B>&#149;</B>&nbsp;&nbsp;Creating and deleting databases
<DD><B>&#149;</B>&nbsp;&nbsp;Adding and deleting database records
<DD><B>&#149;</B>&nbsp;&nbsp;Sorting records in a database
<DD><B>&#149;</B>&nbsp;&nbsp;Searching for records in a database
<DD><B>&#149;</B>&nbsp;&nbsp;Enumerating the databases on a Windows CE device
</DL>

<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>What&#146;s All This SQLing I Hear?</B></FONT>
<P>The database technology provided with the Windows CE operating system is significantly simpler than the full relational or object-oriented databases that you might be used to programming with in the Windows NT or Windows 98 environments. The Windows CE database technology was originally designed to support basic personal information management (PIM) applications.
</P>
<P>The Windows CE database technology is not a relation or object-oriented database. It also does not support Structured Query Language (SQL), the lingua franca of database programmers all over the world. As such, the Windows CE database model is perfectly adequate for relatively simple databases, such as contact lists and collections of e-mail messages. But application developers who need database schema more complex than the simple record-based model of the default Windows CE database have until recently been disappointed. And performing complex searches and queries has been practically impossible due to the lack of SQL.</P>
<P>As Windows CE has matured from its first incarnation over two years ago, so has the level of complexity of software being written for the operating system. Various companies are designing new Windows CE&#150;based consumer and business products, many with database requirements that exceed the capabilities of the basic Windows CE database technology.</P>
<P>Fortunately for these applications, database vendors have recently begun porting their database technologies to Windows CE. Relational as well as object-oriented database solutions are now available from a number of database companies. Oracle, Sybase, and Neoworks Corporations, to name a few, have all begun supporting Windows CE versions of their database software. It is, therefore, now possible to take advantage of traditional database technology, including the power of SQL, when writing software for Windows CE.</P>
<P>Additionally, the Microsoft Foundation Classes library for Windows CE supports Data Access Objects (DAO), providing a SQL-based interface to the Windows CE database technology.</P>
<P>This book, however, will only cover programming for the Windows CE database. Complete coverage of SQL programming and relation and objected-oriented databases is left to the vast number of database programming books on the market today.</P>
</TABLE>

<P>
</P>

<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>Square PEGs in Round Holes</B></FONT>
<P>From time to time as you read the Windows CE on-line documentation, you will see references to things like PEGOID when you would expect CEOID, or function names like <I>PegOpenDatabase</I> when you would swear we&#146;ve been talking endlessly about <I>CeOpenDatabase</I>. What is this all about?</P>
<P>In Windows CE versions 1.0 and earlier, all of the database types and functions started with <I>Peg</I>, instead of <I>Ce</I>. This is a leftover from the code name for Windows CE, which was Pegasus. As Windows CE matured, Microsoft realized that function names like <I>CeOpenDatabase</I> made infinitely more sense to most software developers than <I>PegOpenDatabase</I>. They therefore made the decision (usually considered anathema in most circles) to change the names of the database types and APIs.</P>
<P>This of course left a backward compatibility issue. So in order to make everyone&#146;s Windows CE 1.0 database applications compatible with later versions of the operating system, the old Pegasus names are defined to the new names in the public header file WNDBASE.H:</P>
<!-- CODE SNIP //-->
<PRE>
  #define PEGPROPID           CEPROPID
  *.
  *.
  *.
  #define PegOpenDatabase        CeOpenDatabase
  etc.
</PRE>
<!-- END CODE SNIP //-->
<P>In this way, applications written for older versions of Windows CE can be ported to new versions. Any references to the Peg-prefixed symbols get replaced with the Ce-prefixed versions, and the applications will compile and link without complaints.
</P>
</TABLE>

<P>For each of the functions in the database API, there is a corresponding function in the Remote Application Programming Interface, or RAPI. RAPI is a part of Windows CE that allows applications on a desktop PC, called the RAPI client, to make function calls on a Windows CE device, the RAPI server. RAPI is covered later in Chapter 15.
</P>
<P><FONT SIZE="+1"><B>The Database Design</B></FONT></P>
<P>When designing any database, it is always a good idea to first design the database schema. The database schema is the description of the database and the kinds of information it contains. In our example, this simply means describing what properties each of the phone list records will contain, including the data type of each of the properties. If applicable, you would also define the acceptable range of values that each record property can be assigned. In traditional relational database design, the schema would be more complex, including descriptions of the various relational tables that make up the database. Taking the time up front to do this design step can save you from rewriting the database definition and management code in your applications because you overlooked an important piece of information required by your application.
</P>
<P>The phone list database consists of records that contain these four properties: employee last name, first name, phone number, and department number (Table 7.1). We will allow users of the phone list application to sort the records in the phone list on any of these four properties.</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 7.1</B> Phone List Database Record Definition
<TR>
<TH WIDTH="40%" ALIGN="LEFT">PROPERTY
<TH WIDTH="60%" ALIGN="LEFT">DATA TYPE
<TR>
<TD>Last Name
<TD>LPWSTR
<TR>
<TD>First Name
<TD>LPWSTR
<TR>
<TD>Phone Number
<TD>LPWSTR
<TR>
<TD>Department Number
<TD>short
</TABLE>
<H3><A NAME="Heading4"></A><FONT COLOR="#000077">Internal Representation of Record Properties</FONT></H3>
<P>It is one thing to understand the format of a Windows CE database record in the abstract. It is quite another to understand how Windows CE itself think of records and the properties that they contain.
</P>
<P>Windows CE treats each database record as a collection of one or more properties, each of which is of type CEPROPVAL. The definition of the CEPROPVAL structure is:</P>
<!-- CODE SNIP //-->
<PRE>
   typedef struct _CEPROPVAL
   &#123;
     CEPROPID propid;
     WORD wLenData;
     WORD wFlags;
     CEVALUNION val;
   &#125; CEPROPVAL;
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="189-192.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="196-198.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>


<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- BEGIN SUB FOOTER -->
		<br><br>
		</TD>
    </TR>
	</TABLE>

		
	<table width="640" border=0 cellpadding=0 cellspacing=0>
		<tr>
		<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>
		
		
<!-- END SUB FOOTER -->

<!-- all of the books have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- FOOTER -->
			
		<td width="515" align="left" bgcolor="#FFFFFF">
<font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a>&nbsp;|&nbsp; <a href="/contactus.html"><font color="#006666">Contact Us</font></a>&nbsp;|&nbsp; <a href="/aboutus.html"><font color="#006666">About Us</font></a>&nbsp;|&nbsp; <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> &nbsp;|&nbsp; <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> &nbsp;|&nbsp; <a href="/"><font color="#006666">Home</font></a></b>
		<br><br>
		
		Use of this site is subject to certain <a href="/agreement.html">Terms &amp; Conditions</a>, <a href="/copyright.html">Copyright &copy; 1996-1999 EarthWeb Inc.</a><br> 
All rights reserved.  Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p>
</td>
		</tr>
</table>
</BODY>
</HTML>

<!-- END FOOTER -->

⌨️ 快捷键说明

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