📄 037-040.html
字号:
<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=2//-->
<!--PAGES=037-040//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="034-036.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch03/041-045.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>The MSG Structure</B></FONT>
<P>The MSG structure used by functions like <I>GetMessage</I> contains all of the information about a message that was posted to an application’s message queue. The structure is defined as:</P>
<!-- CODE SNIP //-->
<PRE>
typedef struct tagMSG { // msg
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
</PRE>
<!-- END CODE SNIP //-->
<P>The first four members of this structure are the same parameters that ultimately get sent to the window procedure. <I>time</I> specifies the time at which the message was posted. <I>pt</I> takes on a meaning under Windows CE that is somewhat different from its meaning under other Win32 platforms. Since Windows CE devices don’t use a mouse, there is no concept of a current point. Therefore, rather than indicating the current cursor position, <I>pt</I> indicates the last point touched by the user on the touch screen before the message was posted.</P>
</TABLE>
<P>Adding an asynchronous message to the message queue is called <I>posting</I> the message. As was mentioned above, Windows CE posts many messages to an application. However, applications can also post messages to an application or thread using the <I>PostMessage</I> function. <I>PostMessage</I> has the same argument list as <I>SendMessage</I>. The message posted is added to the message queue of the thread that created the window specified by the <I>hwnd</I> parameter.</P>
<H3><A NAME="Heading6"></A><FONT COLOR="#000077">The Template Application</FONT></H3>
<P>Now that we have a basic understanding of how windows are represented in Windows CE and how they respond to messages, we can present the template application, shown in Figure 2.1.
</P>
<P><A NAME="Fig1"></A><A HREF="javascript:displayWindow('images/02-01.jpg',480,240 )"><IMG SRC="images/02-01t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/02-01.jpg',480,240)"><FONT COLOR="#000077"><B>Figure 2.1</B></FONT></A> The Windows CE Template application.</P>
<P>This application creates a main application window and nothing more. Pressing the left mouse button when the cursor is anywhere inside the window while running the application in emulation (or tapping on it with the stylus if it’s running on a real device) terminates the application. Terminating the application is accomplished with a call to the Windows CE API <I>PostQuitMessage</I>.</P>
<P>You can use this application as the foundation for other real Windows CE applications that you write. It contains all of the boilerplate needed for any Windows CE application: a <I>WinMain</I> function, a message loop, and a main window procedure. Of course you will probably replace the WM_LBUTTONDOWN handler with code of your own.</P>
<P>The project files for this application can be found in the \Samples\ template directory of the companion CD. The application that results from building the project is called TEMPLATE.EXE. The complete source code for the template application is shown in Figure 2.2.</P>
<P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/02-02.jpg',494,1514 )"><IMG SRC="images/02-02t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/02-02.jpg',494,1514)"><FONT COLOR="#000077"><B>Figure 2.2</B></FONT></A> TEMPLATE.EXE source code.</P>
<H3><A NAME="Heading7"></A><FONT COLOR="#000077">Concluding Remarks</FONT></H3>
<P>In this chapter we have covered the basic window and message handling concepts you need to understand in order to write Windows CE applications. To make your applications more useful, you will want to use Windows CE controls and dialog boxes to allow users to interact with your applications. The next chapter describes how to program Windows CE controls and various kinds of dialog boxes.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="034-036.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch03/041-045.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 + -