📄 291-294.html
字号:
<option value="/reference/dir.middleware.html">Middleware
<option value="/reference/dir.multimediaandgraphicdesign1.html">Multimedia
<option value="/reference/dir.networkservices1.html">Networks
<option value="/reference/dir.operatingsystems.html">OS
<option value="/reference/dir.productivityapplications1.html">Prod Apps
<option value="/reference/dir.programminglanguages.html">Programming
<option value="/reference/dir.security1.html">Security
<!-- <option value="/reference/dir.ewtraining1.html">Training Guides -->
<option value="/reference/dir.userinterfaces.html">UI
<option value="/reference/dir.webservices.html">Web Services
<option value="/reference/dir.webmasterskills1.html">Webmaster
<option value="/reference/dir.y2k1.html">Y2K
<option value="">-----------
<option value="/reference/whatsnew.html">New Titles
<option value="">-----------
<option value="/reference/dir.archive1.html">Free Archive
</SELECT>
</font></td>
</tr>
</table>
</form>
<!-- LEFT NAV SEARCH END -->
</td>
<!-- PUB PARTNERS END -->
<!-- END LEFT NAV -->
<td rowspan="8" align="right" valign="top"><img src="/images/iswbls.gif" width=1 height=400 alt="" border="0"></td>
<td><img src="/images/white.gif" width="5" height="1" alt="" border="0"></td>
<!-- end of ITK left NAV -->
<!-- begin main content -->
<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=""> <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=11//-->
<!--PAGES=291-294//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="289-291.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="294-297.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading3"></A><FONT COLOR="#000077">Packaging a Custom Control as a Dynamic Link Library</FONT></H3>
<P>The first thing to think about when implementing a Windows CE custom control is <I>not</I> how to make the control green. Programming the various appearance and behavioral aspects of the control comes second.</P>
<P>Your first concern as a custom control developer should be how to package the control. Your decision to implement a custom control was probably motivated by the specific requirements of one Windows CE application. But if designed properly, your control may find use in a number of different applications. You may even be able to sell it to other software developers.</P>
<P>If a custom control is implemented inside an application that uses it, it is very hard for another application to use. Therefore, it is highly recommended that any custom control be implemented in a dynamic link library, or DLL. The control is thus packaged as a stand-alone module that can be used by any number of applications.</P>
<P><FONT SIZE="+1"><B>DLL Basics</B></FONT></P>
<P>There are numerous resources that explore the details of dynamic link libraries in far more depth than can be covered here. This chapter will, however, highlight the main points of DLL programming and point out some of the benefits of using DLLs.
</P>
<P>A dynamic link library is very similar to an executable application. A DLL can contain data, resources, and executable code just like an .EXE file. But a DLL is not a program. It is not run like an application. Applications load DLLs and use the data and resources they contain or call functions implemented inside the DLL. Dynamic link libraries are often called <I>application extensions</I> because they only become useful within the context of a running application.</P>
<P>Another important feature of dynamic link libraries relates to how functions in the DLL are linked to an application that uses them. Applications can link either <I>statically</I> or <I>dynamically</I> with the functions in a DLL.</P>
<P>When a DLL is loaded by an application, it technically means that a copy of the DLL is placed in the program memory of the application. The DLL and the application share the same address space. This is why more than one application can use the same DLL at the same time. For example, more than one Windows CE application written using MFC can run at the same time because each application has its own copy of the MFC DLL.</P>
<P><FONT SIZE="+1"><B><I>Static Linking</I></B></FONT></P>
<P>When you compile and link a dynamic link library, the DLL gets created as a file with the extension .DLL. Another file, called the <I>import library</I>, is also created with the extension .LIB. This file contains one or more <I>import records</I>, one for each function exported by the dynamic link library. Each import record contains the name of the DLL that contains the code implementing the function. It also contains either the name of the function or its <I>ordinal number</I>, or both. The ordinal number is simply a number that uniquely identifies a function in a DLL.</P>
<P>When an application statically links with a DLL, it means that the application links with the corresponding import library at link time. The information from the import records corresponding to any DLL functions referenced by the application get copied into the application’s .EXE file.</P>
<P>When the application runs, Windows CE looks for any dynamic links in the .EXE file. Windows CE loads any DLLs referenced in these links that are not already loaded and resolves the import record function reference to the actual address of the function in the DLL. Hence, whenever the application calls a function in a DLL with which it was linked, it can call into the proper function code at run-time.</P>
<P><FONT SIZE="+1"><B><I>Dynamic Linking</I></B></FONT></P>
<P>One disadvantage of static linking is that when an application that statically links with a DLL starts executing, the DLL is loaded as well—even if the application only calls one function in that DLL, and that very rarely. So the DLL takes up room in the application’s address space even when it is not in use. This can become problematic if an application uses many DLLs, especially in Windows CE environments where memory is often in short supply.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="289-291.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="294-297.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> | <a href="/contactus.html"><font color="#006666">Contact Us</font></a> | <a href="/aboutus.html"><font color="#006666">About Us</font></a> | <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> | <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> | <a href="/"><font color="#006666">Home</font></a></b>
<br><br>
Use of this site is subject to certain <a href="/agreement.html">Terms & Conditions</a>, <a href="/copyright.html">Copyright © 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 + -