📄 372-375.html
字号:
<!-- 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=14//-->
<!--PAGES=372-375//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="367-372.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="375-377.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B><I>Registering the Data Types</I></B></FONT></P>
<P>Not only must you register our ActiveSync service provider, but you need to register each data type synchronized by the service provider. Each data type synchronized has its own subkey in the following hierarchy:
</P>
<!-- CODE SNIP //-->
<PRE>
HKEY_CURRENT_USER\Software\Microsoft\Windows CE Services\Partners\<PartnerID>
\Services\Synchronization\Objects
</PRE>
<!-- END CODE SNIP //-->
<P><Partner ID> is the partnership identifier of the partnership between the Windows CE device and the desktop computer. You do not have to generate this identifier or the corresponding registry subkey. It was created for you when you installed Windows CE Services and first created a partnership for your Windows CE device. This Partner ID subkey contains a variety of values with information about the device.
</P>
<P>Under the Objects subkey, you must create a new subkey for each data type synchronized by the ActiveSync service provider. Since the phone list application only uses one data type, you only need to create one data type subkey:</P>
<!-- CODE SNIP //-->
<PRE>
HKEY_CURRENT_USER\Software\Microsoft\Windows CE Services\Partners\<PartnerID>
\Services\Synchronization\Objects\PhoneApp
</PRE>
<!-- END CODE SNIP //-->
<P>Create three new string values in this subkey called Display Name, Plural Name, and Store. The first two values contain the singular and plural names of the data object represented by the PhoneApp subkey. These values will occasionally be used by the ActiveSync service manager in user interfaces it displays during synchronization.
</P>
<P>The Store value is far more important. This contains the programmatic identifier of the service provider that implements the IReplStore and IReplObjHandler interfaces for this data type.</P>
<P>To complete the PHONEDESK.REG file, add the following:</P>
<!-- CODE SNIP //-->
<PRE>
[HKEY_CURRENT_USER\Software\Microsoft\Windows CE Services\Partners
\15616b0e\Services\Synchronization\Objects\PhoneApp]
@="PhoneApp"
"Display Name"="Phone Entry"
"Plural Name"="Phone Entries"
"Store"="Wiley.PhoneApp"
</PRE>
<!-- END CODE SNIP //-->
<P>You now have a registry file that will create all the necessary registry subkeys and assign all of the right values to register the phone list application desktop service provider. This file will also properly register the data types to be synchronized.
</P>
<P>To insert these values into the registry, run the following command from a DOS prompt:</P>
<!-- CODE SNIP //-->
<PRE>
REGEDIT PHONEDESK.REG
</PRE>
<!-- END CODE SNIP //-->
<P>This command will import the subkeys and values defined in PHONEDESK.REG into the registry.
</P>
<P><FONT SIZE="+1"><B>Registering the Device Service Provider</B></FONT></P>
<P>Registering the Windows CE device service provider is much simpler than registering the desktop service provider. You simply create a subkey for each synchronized data type under the following hierarchy:
</P>
<!-- CODE SNIP //-->
<PRE>
HKEY_LOCAL_MACHINE\Windows CE Services\Synchronization\Objects
</PRE>
<!-- END CODE SNIP //-->
<P>Each of these data type subkeys contains one required value called Store. This value contains the path name of the DLL that implements the desktop service provider.
</P>
<P>The optional value Display Name can also be defined. This value is analogous to the Display Name values registered on the desktop PC.</P>
<P>In the case of the phone list application with a device service provider implemented in PHDEVS.DLL, the registry subkey and value you would add to the device registry are shown in Figure 14.4. Such a registration would require that the DLL PHDEVS.DLL be copied to the Windows directory of the device.</P>
<P><A NAME="Fig4"></A><A HREF="javascript:displayWindow('images/14-04.jpg',574,313 )"><IMG SRC="images/14-04t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/14-04.jpg',574,313)"><FONT COLOR="#000077"><B>Figure 14.4</B></FONT></A> Registering a device service provider.</P>
<P>There is an alternative to registering the device service provider manually. The application DEVSETUP.EXE, created by the DevSetup project on the companion CD, is a Windows CE application that will register the device service provider for you. Simply build the application, download it to your device, and run it.
</P>
<P>When the ActiveSync service starts, or when a user initiates a data synchronization, the ActiveSync service manager looks in the desktop and device registries to determine what data types to synchronize. On the desktop and device, the service manager gets the programmatic identifier for each registered synchronization data type. It then creates instances of the IReplStore and IReplObjHandler interfaces for each of the corresponding service providers.<SUP><SMALL><B>1</B></SMALL></SUP></P>
<BLOCKQUOTE>
<HR>
<SUP><SMALL><B>1</B></SMALL></SUP><FONT SIZE="-1">In reality, this is done by COM. The service manager maps the programmatic identifier to the class identifier of the service provider. <I>CoCreateInstance</I> then gets called using this identifier to create the interface instances.
</FONT>
<HR>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="367-372.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="375-377.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 + -