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

📄 325-328.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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=12//-->
<!--PAGES=325-328//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="322-325.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch13/329-333.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading8"></A><FONT COLOR="#000077">Displaying Inline Images</FONT></H3>
<P>The HTML viewer control provides limited support to displaying images referenced in HTML formatted text. The control sends a notification to its parent window when it encounters an IMG reference in HTML text, but makes no attempt to render the image. As with moving among hyperlinks, this is the responsibility of the application.
</P>
<P>An example of including an inline image in an HTML file is:</P>
<!-- CODE SNIP //-->
<PRE>
   &lt;IMG SRC="image.gif"&gt;
</PRE>
<!-- END CODE SNIP //-->
<P>When an HTML viewer control encounters such a tag, for example while responding to a DTM_ADDTEXT message, it alerts its parent that an image needs to be loaded by sending an NM_INLINE_IMAGE notification.
</P>
<P>As with the NM_HOTSPOT notification, the control sends an NM_HTMLVIEW structure in the <I>lParam</I> of the WM_NOTIFY message.</P>
<P>The <I>szTarget</I> member of this structure contains the text following the SRC parameter in the HTML text. In the example above, <I>szTarget</I> would contain the string &#147;image.gif.&#148;</P>
<P>In the case of NM_INLINE_IMAGE notifications, the <I>szData</I> member of the NM_HTMLVIEW structure is not used. But the <I>dwCookie</I> value is. It contains a value that must be passed to the DTM_SETIMAGE message described a little later.</P>
<P>The basic idea to take away from this discussion is that the HTML viewer control only notifies its parent window that a reference to an image has been detected. It is up to the application to load and display the image. But the application gets a little help in this from the DTM_SETIMAGE message.</P>
<P><FONT SIZE="+1"><B>The DTM_SETIMAGE Message</B></FONT></P>
<P>An application tells an HTML viewer control how to display an inline image by sending the control a DTM_SETIMAGE message. This message associates an inline image with a bitmap sent with the message. In other words, after responding to this message, the HTML viewer control displays the specified bitmap in place of the inline image. The parameters for DTM_SETIMAGE are described in Table 12.2.
</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 12.2</B> The DTM_SETIMAGE Message
<TR>
<TH WIDTH="40%" ALIGN="LEFT">PARAMETER
<TH WIDTH="60%" ALIGN="LEFT">MEANING
<TR>
<TD>wParam
<TD>Not used.
<TR>
<TD VALIGN="TOP">(LPINLINEIMAGEINFO)lParam
<TD>Pointer to an INLINEIMAGEINFO structure that defines the bitmap to use.
</TABLE>
<P>The application must specify the various attributes of the bitmap to be used for the inline image. This information is specified in an INLINEIMAGEINFO structure:
</P>
<!-- CODE SNIP //-->
<PRE>
   typedef struct tagINLINEIMAGEINFO
   &#123;
     DWORD dwCookie;
     int iOrigHeight;
     int iOrigWidth;
     HBITMAP hbm;
     BOOL bOwnBitmap;
   &#125; INLINEIMAGEINFO, *LPINLINEIMAGEINFO;
</PRE>
<!-- END CODE SNIP //-->
<P>The <I>dwCookie</I> member of this structure is the same value sent by the control in its NM_INLINE_IMAGE notification. <I>iOrigHeight</I> and <I>iOrigWidth</I> specify the height and width of the bitmap. The bitmap itself is contained in the <I>hbm</I> member.</P>
<P>Finally, <I>bOwnBitmap</I> specifies who is responsible for destroying the bitmap resource once it has been displayed. If this member is TRUE, the HTML viewer control must free the resource. If <I>bOwnBitmap</I> is FALSE, the application is telling the control that the application will handle destroying the bitmap.</P>
<P>Related to the DTM_SETIMAGE message is DTM_IMAGEFAIL. An application sends this message to an HTML viewer control to indicate that the image specified in an NM_INLINE_IMAGE notification could not be loaded. The control responds by displaying the default &#147;broken image&#148; bitmap for that inline image.</P>
<P>All of this means, of course, that an application that wishes to properly display inline images in an HTML viewer control must have a way of converting the image data in a particular image file into a Windows CE bitmap resource. The NM_INLINE_IMAGE notification tells the application that an inline image has been detected. It does not convert the referenced image file into the required Windows CE bitmap resource.</P>
<H3><A NAME="Heading9"></A><FONT COLOR="#000077">HTML Viewer Control Messages and Notifications</FONT></H3>
<P>The HTML viewer control supports many more messages and notifications than those we have detailed. The examples in this chapter should provide enough insight into the use of the HTML viewer to make using the rest of the control features easy.
</P>
<P>A complete list of messages and notifications associated with the HTML viewer control are given in Tables 12.3 and 12.4.</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 12.3</B> HTML Viewer Control Messages
<TR>
<TH WIDTH="40%" ALIGN="LEFT">MESSAGE
<TH WIDTH="60%" ALIGN="LEFT">BEHAVIOR
<TR>
<TD VALIGN="TOP">DTM_ADDTEXT
<TD>Adds the specified ANSI text to the control. The <I>wParam</I> indicates if the text is plain or HTML formatted text.
<TR>
<TD>DTM_ADDTEXTW
<TD>Unicode version of DTM_ADDTEXT.
<TR>
<TD>DTM_ANCHOR
<TD>Tells the control to jump to the specified anchor.
<TR>
<TD>DTM_ANCHORW
<TD>Unicode version of DTM_ANCHOR.
<TR>
<TD VALIGN="TOP">DTM_ENABLESHRINK
<TD>Toggles the control image shrink mode. The control shrinks images to make the HTML document fit the control window.
<TR>
<TD VALIGN="TOP">DTM_ENDOFSOURCE
<TD>Tells the control that the application is done adding text to the control.
<TR>
<TD VALIGN="TOP">DTM_IMAGEFAIL
<TD>Used to inform the control that the specified image could not be loaded.
<TR>
<TD>DTM_SETIMAGE
<TD>Associates the specified bitmap with an inline image.
<TR>
<TD>DTM_SELECTALL
<TD>Selects (highlights) all text displayed in the control.
</TABLE>
<P>
</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 12.4</B> HTML Viewer Control Notifications
<TR>
<TH WIDTH="40%" ALIGN="LEFT">NOTIFICATION
<TH WIDTH="60%" ALIGN="LEFT">MEANING
<TR>
<TD>NM_BASE
<TD>Sent by the control when it encounters a BASE tag in HTML text.
<TR>
<TD VALIGN="TOP">NM_CONTEXTMENU
<TD>Sent by the control when the user taps the client area of the control while pressing the Alt key.
<TR>
<TD VALIGN="TOP">NM_HOTSPOT
<TD>Sent by the control when a user taps a hyperlink or submits a form.
<TR>
<TD ALIGN="TOP">NM_INLINE_IMAGE
<TD>Sent by the control to tell the application that an image needs to be loaded.
<TR>
<TD VALIGN="TOP">NM_INLINE_SOUND
<TD>Sent by the control to tell the application that a sound file needs to be loaded.
<TR>
<TD VALIGN="TOP">NM_META
<TD>Sent by the control when it encounters a META tag in HTML text. Notification includes the HTTP-EQUIV and CONTENT parameters of this tag.
<TR>
<TD VALIGN="TOP">NM_TITLE
<TD>Sent by the control when it encounters a TITLE tag in HTML text. Notification includes the document title.
</TABLE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="322-325.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch13/329-333.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 + -