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

📄 412-415.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:

<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="">&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=15//-->
<!--PAGES=412-415//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="409-412.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="415-419.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B>The ICeFileFilter Interface</B></FONT></P>
<P>Just like ActiveSync service providers, Windows CE file filters are implemented as COM in-process server dynamic link libraries. Each file filter must implement the COM interface ICeFileFilter.
</P>
<P>This interface only exposes three methods. These methods are listed in Table 15.2. Of these methods, <I>NextConvertFile</I> is by far the most important. This method is responsible for performing the actual file data conversion duties of the corresponding file filter.</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 15.2</B> ICeFileFilter Methods
<TR>
<TH WIDTH="35%" ALIGN="LEFT">METHOD
<TH WIDTH="65%" ALIGN="LEFT">PURPOSE
<TR>
<TD>NextConvertFile
<TD>Converts file data from one format to another.
<TR>
<TD VALIGN="TOP">FilterOptions
<TD>Displays a dialog box allowing the user to select supported file filter options.
<TR>
<TD VALIGN="TOP">FormatMessage
<TD>Formats a message string for user interface display. This method is analogous to the Win32 <I>FormatMessage</I> API.
</TABLE>
<P>The <I>NextConvertFile</I> method has this definition:</P>
<!-- CODE SNIP //-->
<PRE>
  HRESULT NextConvertFile(nConversion, pci, psf,
    pdf,pbCancel,perr);
</PRE>
<!-- END CODE SNIP //-->
<P>This cryptic set of parameters contains all the information a file filter needs to open the file being converted as well as to write the destination file.
</P>
<P><I>NextConvertFile</I> is called repeatedly by Windows CE Services until your filter code tells it to stop. <I>nConversion</I> is an integer that tells you how many times the method has been called. This parameter is used as a counter for converting a single file into multiple destination files.</P>
<P>Generally, you will write file filters that convert one source file to one destination file. Therefore, if <I>nConversion</I> is not zero, you need to tell Windows CE Services to stop calling <I>NextConvertFile</I>. You do this by returning HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS).</P>
<P><I>pbCancel</I> is a pointer to a BOOL indicating if the user has pressed the cancel button in the file transfer dialog. Implementations of <I>NextConvertFile</I> should periodically check this value to see if the user has aborted file conversion.</P>
<P><I>perr</I> is a pointer to an error value that can be returned. This value is in turn passed to <I>FormatMessage</I>.</P>
<P>The remaining parameters contain all of the information about the source and destination file and file conversion information.</P>
<P><I>pci</I> is a pointer to a CFF_CONVERTINFO structure. This structure supplies the filter with information about the file conversion. <I>psf</I> is a CFF_SOURCEFILE structure pointer. This structure defines the source file. Finally, the <I>pdf</I> parameter is a pointer to a CFF_DESTINATIONFILE structure, which contains information about the destination file.</P>
<P>These three new data types are described in the following sections.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B><B>T<SMALL>HE</SMALL> IC<SMALL>E</SMALL>F<SMALL>ILE</SMALL>F<SMALL>ILTER</SMALL>O<SMALL>PTIONS</SMALL> I<SMALL>NTERFACE</SMALL></B>
<P><B>For a Windows CE file filter to include user-selectable conversion options, it must implement the ICeFileFilterOptions interface as well as ICeFileFilter. We do not cover the ICeFileFilterOptions interface in this chapter.</B><HR></FONT>
</BLOCKQUOTE>
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B><B>F<SMALL>ILE</SMALL> F<SMALL>ILTER</SMALL> T<SMALL>YPE</SMALL> N<SMALL>AMES</SMALL></B>
<P><B>As you write file filters and browse through the Microsoft Developer Studio on-line documentation, you will see type names like PFF_CONVERTINFO and IPegasusFileFilter. These were the type names assigned back in the Windows CE 1.0 beta days, when the operating system was code-named Pegasus. As with the Windows CE database APIs, the new names like CFF_CONVERTINFO have been created as aliases for the old names with typedef statements throughout the header file CEFLTMAP.H.</B><HR></FONT>
</BLOCKQUOTE>
</P>
<P><FONT SIZE="+1"><B><I>The CFF_CONVERTINFO Structure</I></B></FONT></P>
<P>The definition of the CFF_CONVERTINFO structure is:
</P>
<!-- CODE SNIP //-->
<PRE>
  typedef struct tagCFF_CONVERTINFO
  &#123;
    BOOL bImport;
    HWND hwndParent;
    BOOL bYesToAll;
    ICeFileFilterSite *pffs;
  &#125; CFF_CONVERTINFO;
</PRE>
<!-- END CODE SNIP //-->
<P>The <I>bImport</I> member indicates whether the <I>NextConvertFile</I> function is being called to import or export a file. This allows a particular ICeFileFilter implementation to act as both an import and an export file filter. By checking this member, <I>NextConvertFile</I> can decide which file conversion code to execute.</P>
<P><I>hwndParent</I> can be used as the parent window for dialog boxes that might need to be displayed during conversion. <I>bYesToAll</I> is used by <I>NextConvertFile</I> to tell Windows CE Services whether to include a Yes To All button in the Confirm File Replace dialog. This would be done if a source file is to be converted into more than one destination file which must be overwritten. Figure 15.3 shows a Confirm File Replace dialog without this button.</P>
<P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/15-03.jpg',391,315 )"><IMG SRC="images/15-03t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/15-03.jpg',391,315)"><FONT COLOR="#000077"><B>Figure 15.3</B></FONT></A>&nbsp;&nbsp;The Confirm File Replace dialog.</P>
<P>Finally, the <I>pffs</I> member points to an ICeFileFilterSite interface instance. Among the methods exposed by this interface are methods for opening and closing source and destination files.</P>
<P>For example, the <I>OpenSourceFile</I> method opens the source file:</P>
<!-- CODE SNIP //-->
<PRE>
  HRESULT OpenSourceFile(nHowToOpenFile, ppObj);
</PRE>
<!-- END CODE SNIP //-->
<P><I>nHowToOpenFile</I> is an integer describing how the file should be opened. Passing PF_OPENFLAT opens the file as a flat file and returns an IStream interface pointer to the file data through <I>ppObj</I>.</P>
<P>The <I>CloseSourceFile</I> method of ICeFileFilterSite closes a file opened by an <I>OpenSourceFile</I> call.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="409-412.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="415-419.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 + -