﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-浅蓝色的琴弦-随笔分类-Wince</title><link>http://www.cppblog.com/platox/category/14671.html</link><description>微风祈愿</description><language>zh-cn</language><lastBuildDate>Fri, 17 Sep 2010 03:04:30 GMT</lastBuildDate><pubDate>Fri, 17 Sep 2010 03:04:30 GMT</pubDate><ttl>60</ttl><item><title>com问题..应该来算是GUID问题..</title><link>http://www.cppblog.com/platox/archive/2010/09/15/126666.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Wed, 15 Sep 2010 07:51:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/09/15/126666.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/126666.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/09/15/126666.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/126666.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/126666.html</trackback:ping><description><![CDATA[今天使用WINCE IMAGE COM组件的时候<br>1&gt;WinMain.obj : error LNK2001: unresolved external symbol CLSID_ImagingFactory<br>1&gt;WinMain.obj : error LNK2001: unresolved external symbol IID_IImagingFactory<br><br>外部符号无法连接...<br><br>这会又的查MSDN了<br><br>原来是GUID导致的...<br><br>在 Microsoft Visual c + + 中，如果超过一个特定版本的编译器版本 GUID 必须初始化一次。由于这个原因有两个不同版本的 DEFINE_GUID 宏。一个版本只是声明对符号名的外部引用。其他版本实际上初始化符号名的 GUID 的值。如果您收到一个未初始化的符号名的该的 GUID GUID 错误 LNK2001。<br><br><strong>注意</strong>DEFINE_GUID 宏 guiddef.h 头文件中的声明一个 GUID。此外定义 GUID，请在其中定义 $ GUID 的源文件中包括 INITGUID.H 头文件。<br><br>您可以确保您 GUID 获取初始化在两种方法之一：
<ul>
    <li>如果使用的预编译的头文件包括 INITGUID.H 头文件之前应该初始化它的实现文件中定义 GUID。（应用程序向导生成的 MFC 项目时使用预编译的头默认情况下）。
    <li>如果您不使用预编译的头，定义 INITGUID 包括 OBJBASE.H 之前。（OBJBASE.H 包含由 OLE2.H）。</li>
</ul>
<strong>注意</strong>如果您正在使用预编译的头时，比某个特定版本的编译器版本，您可以在单个的头文件，包括其他头文件中包括 INITGUID.H 头文件。这将导致在其中此头文件是包含的所有源代码文件中定义 GUID。您将不会收到一个 LNK2001 错误，即使一个符号被定义多次。这是因为在 DEFINE_GUID 宏使用一个 <strong>DECLSPEC_SELECTANY</strong> 关键字。该关键字可确保链接器可以正确处理此多个定义。<br><br><a href="http://support.microsoft.com/kb/130869">http://support.microsoft.com/kb/130869</a>&nbsp;地址..<br><br><br><br>用#Define INITGUID<br>//头文件...<br>#undef INITGUID<br><br>就可以解决了.<br>
<img src ="http://www.cppblog.com/platox/aggbug/126666.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-09-15 15:51 <a href="http://www.cppblog.com/platox/archive/2010/09/15/126666.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Wince6.0 SDK  DMA 选项问题</title><link>http://www.cppblog.com/platox/archive/2010/09/07/126113.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Tue, 07 Sep 2010 13:12:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/09/07/126113.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/126113.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/09/07/126113.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/126113.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/126113.html</trackback:ping><description><![CDATA[<p>以前做SDK5.0的时候 就翻文<br><br>WINce 5.0或6.0 都要做这一步（反正我都做拉, 没做的没试过）</p>
<p><span style="FONT-FAMILY: tahoma, arial, helvetica, sans-serif"><span style="FONT-SIZE: small"><span style="FONT-FAMILY: times new roman, times"><font size=2><font face="">&nbsp;<span style="COLOR: #ff0000">Build Options选项卡下，去掉Enable CE Target Control Support和Enable KITL;（如果不去掉可能会导致模拟器黑屏）<br><br></span></font></font></span></span></span><span style="FONT-FAMILY: tahoma, arial, helvetica, sans-serif"><span style="FONT-SIZE: small"><span style="FONT-FAMILY: times new roman, times"><font size=2><font face="">&nbsp;<span style="COLOR: #ff0000">Environment选项卡，添加环境变量CE_MODULES_SERIAL=1，这是用来将DMA添加进来;（这十分重要）</span></font></font></span></span></span></p>
<p><br>下面是分支。。先是5.0的&nbsp; 我直接转别人的贴<br><br><br>2. 用记事本等工具打开\WINCE500\PBWorkspaces\MyPlatform\ExportSDK.sdkcfg</p>
<p>3.找到&lt;PropertyBag NAME="DeviceEmulation"&gt;一段，添加如下信息：</p>
<p>&lt;PropertyBag NAME="DeviceEmulation"&gt;<br>&nbsp; &lt;Property NAME="Default Image"&gt;1&lt;/Property&gt;<br>&nbsp; &lt;PropertyBag NAME="1"&gt;<br>&nbsp;&nbsp; &lt;Property NAME="ImageName"&gt;My Emulator&lt;/Property&gt;&nbsp; ；(在VS上显示的模拟器的名字)<br>&nbsp;&nbsp; &lt;Property NAME="VMID"&gt;{6CB9C6E3-E576-4580-BC1E-ADED62B97FFB}&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Default Skin"/&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Height"&gt;400&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Width"&gt;240&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="BitDepth"&gt;16&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Memory"&gt;128&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Bin Dest"&gt;Emulator\NK.bin&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Fixed Screen"&gt;1&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="CpuName"&gt;ARMV4I&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="DPIX"&gt;96&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="DPIY"&gt;96&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="SupportRotation"&gt;0&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Enabled"&gt;1&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Bin Path"&gt;&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Ethernet"&gt;1&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Ports"&gt;1&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="AdditionalParameters"&gt;<br>&nbsp;&nbsp; &lt;/Property&gt;<br>&nbsp;&nbsp; &lt;PropertyBag NAME="Skins"/&gt;<br>&nbsp; &lt;/PropertyBag&gt;<br>&nbsp;&lt;/PropertyBag&gt;</p>
<p>根据文档的说明修改相应的模拟器屏幕尺寸等信息。并添加如下内容：</p>
<p>&lt;PropertyBag NAME="Added Files"&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;PropertyBag NAME="{3B388597-0924-4102-ADFA-2519D2C3E11B}"&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Property NAME="Source"&gt;C:\WINCE500\PBWorkspaces\Emulator\Addfile&lt;/Property&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Property NAME="Destination"&gt;Emulation&lt;/Property&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Property NAME="Subfolders"&gt;0&lt;/Property&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/PropertyBag&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;/PropertyBag&gt;</p>
<p>C:\WINCE500\PBWorkspaces\Emulator\Addfile此路径是自己建立的，其中存放Emulator的nk.bin(此处仅放这一文件，否则生成SDK时会将这一目录下的内容全部压缩进去)</p>
<p>完成后保存文件。</p>
<p>4.Platform-&gt;SDK-&gt;Build SDK 等待完成。</p>
<p><br>本文来自CSDN博客，转载请标明出处：<a href="http://blog.csdn.net/Veabol/archive/2009/09/04/4520154.aspx">http://blog.csdn.net/Veabol/archive/2009/09/04/4520154.aspx</a><br><br><br>下面是6.0的。。翻了很多文。始终找不到。后来去SDK对比一下。<br><br>打开SDK配置文件 如F:\WinCEspaces\WinCEOS\GPSos\GPSos\SDKs\SDK2\SDK2.sdkcfg<br><br>找到<br>&nbsp;&nbsp;&nbsp;&lt;Property NAME="Enabled"&gt;1&lt;/Property&gt;<br>&nbsp;&nbsp;&nbsp;&lt;Property NAME="Bin Dest"&gt;Emulator\NK.bin&lt;/Property&gt;<br>&nbsp;&nbsp; &lt;Property NAME="Bin Path"&gt;&lt;/Property&gt;<br>这个地方<br>&nbsp; 貌似 感觉 Enadbled 是打开DMA选项的关键<br>&nbsp;&lt;Property NAME="Bin Dest"&gt;Emulator\NK.bin&lt;/Property&gt;&nbsp; 这个是一个目标文件夹。相对路径。貌似是相对SDK安装的路径<br>&nbsp;&lt;Property NAME="Bin Path"&gt;&lt;/Property&gt;&nbsp; 这个地方 我找了好久 原来是这个地方的错误。。这个路径是据对路径带文件名<br>如&lt;Property NAME="Bin Path"&gt;c:\CrossbowBuild\15252\wpc\0409\DeviceEmulation\0409\PPC_USA.bin&lt;/Property&gt;<br><br>改了这3个地方 基本就能生成带 DMA 选项的SDK了。。。。<br><br><br></p>
<img src ="http://www.cppblog.com/platox/aggbug/126113.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-09-07 21:12 <a href="http://www.cppblog.com/platox/archive/2010/09/07/126113.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VS2005 Wxwidget for Pocket PC SDK</title><link>http://www.cppblog.com/platox/archive/2010/08/25/124673.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Wed, 25 Aug 2010 05:31:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/08/25/124673.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/124673.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/08/25/124673.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/124673.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/124673.html</trackback:ping><description><![CDATA[<p>Wxwidget 很早就支持WINce了， 最近才拿起来用，<br>编译的路途是艰辛的。<br><br>系统WINDOWS xp，软件 vs2005，wince pocket pc SDK， wxwidget2.8.11。。<br>因为我有装standardsdk包。所以想编译STAND500 版本。 行不通。<br>所以老实的编译PPC版本.<br>我编译了 release 和 release dll 版。<br><br>编译release版比较简单。<br>编译release dll 需要注意。。<br>它有一个工具要生成一个头文件，不必要在意。等编译完，在编译一次。<br>2.8.11。有几个工程名字没改过来。相信大家都有注意。wx_的前缀。<br>还有一个nono.lib，其实就是wxwidget28.lib.&nbsp; 改了连接库的名字后先生成nono项目。<br>在生成gl项目。 他们依赖于一个头文件。。如果先生成gl项目。。生成nono项目就会报错。。<br></p>
<img src ="http://www.cppblog.com/platox/aggbug/124673.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-08-25 13:31 <a href="http://www.cppblog.com/platox/archive/2010/08/25/124673.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VS2005 WINCEROOT问题</title><link>http://www.cppblog.com/platox/archive/2010/08/23/124456.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Mon, 23 Aug 2010 11:21:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/08/23/124456.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/124456.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/08/23/124456.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/124456.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/124456.html</trackback:ping><description><![CDATA[<p>网上找了一些解决的办法，不是太详细。<br>VS2005 报WINCEROOT目录 ，修复PB6.0 和修复PB6.0SP1， 一定要修复PB6.0SP1，不然在VS2005菜单栏的工具-选项-就不会显示PB的设置</p>
<img src ="http://www.cppblog.com/platox/aggbug/124456.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-08-23 19:21 <a href="http://www.cppblog.com/platox/archive/2010/08/23/124456.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WinCE 注册表 API</title><link>http://www.cppblog.com/platox/archive/2010/08/21/124168.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Sat, 21 Aug 2010 04:00:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/08/21/124168.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/124168.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/08/21/124168.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/124168.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/124168.html</trackback:ping><description><![CDATA[<h1 class=dtH1>
<p>//建立注册字段<br>This function creates the specified key. If the key already exists in the registry, the function opens it.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegCreateKeyExRAPI">CeRegCreateKeyEx (RAPI)</mshelp:link>. </p>
<pre class=syntax><strong>LONG</strong> <strong>RegCreateKeyEx( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>hKey</font></u></a></em><strong>, </strong>
<strong>LPCWSTR</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>lpSubKey</font></u></a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>Reserved</font></u></a></em><strong>, </strong>
<strong>LPWSTR</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>lpClass</font></u></a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>dwOptions</font></u></a></em><strong>, </strong>
<strong>REGSAM</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>samDesired</font></u></a></em><strong>, </strong>
<strong>LPSECURITY_ATTRIBUTES</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>lpSecurityAttributes</font></u></a></em><strong>, </strong>
<strong>PHKEY</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>phkResult</font></u></a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href=""><u><font color=#0000ff>lpdwDisposition</font></u></a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or one of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<p>Windows CE does not support the HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA, or HKEY_DYN_DATA predefined reserved handle values.
<p>The key opened or created by the <strong>RegCreateKeyEx</strong> function is a subkey of the key identified by the <em>hKey</em> parameter. </p>
<dt><em>lpSubKey</em>
<dd>[in] Pointer to a null-terminated string specifying the name of a subkey that this function opens or creates. The subkey specified must be a subkey of the key identified by the <em>hKey</em> parameter. This subkey must not begin with the backslash character (\). If the parameter is NULL, then <strong>RegCreateKeyEx</strong> behaves like <strong>RegOpenKey</strong> where it opens the key specified by <em>hKey</em>. In Windows CE, the maximum length of a key name is 255 characters, not including the terminating NULL character. You can also only nest 16 levels of sub-keys in Windows CE.
<dt><em>Reserved</em>
<dd>[in] Reserved; set to 0.
<dt><em>lpClass</em>
<dd>[in] Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists. In Windows CE, the maximum length of a class string is 255 characters, not including the terminating NULL character.
<dt><em>dwOptions</em>
<dd>[in] Registry key options. The following table shows the possible values for this parameter.
<div class=tablediv>
<table class=dtTABLE cellSpacing=0>
    <tbody>
        <tr vAlign=top>
            <th width="50%">Value</th>
            <th width="50%">Description</th>
        </tr>
        <tr vAlign=top>
            <td width="50%">REG_OPTION_NON_VOLATILE</td>
            <td width="50%">Default setting. All registry keys are created as non-volatile and the information stored in memory is preserved when the OS is restarted. The <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregsavekey.htm"><u><font color=#0000ff>RegSaveKey</font></u></a> function saves keys that are non-volatile.</td>
        </tr>
        <tr vAlign=top>
            <td width="50%">REG_OPTION_VOLATILE</td>
            <td width="50%">All registry keys are created as volatile, and the information is stored in memory and is not preserved when the corresponding registry hive is unloaded. For HKEY_LOCAL_MACHINE, this occurs when the OS is shut down. The <strong>RegSaveKey</strong> function does not save volatile registry keys. This flag is ignored for keys that already exist.</td>
        </tr>
    </tbody>
</table>
</div>
<dt><em>samDesired</em>
<dd>[in] Ignored; set to 0 to ensure compatibility with future versions of Windows CE.
<dt><em>lpSecurityAttributes</em>
<dd>[in] Set to NULL. Windows CE automatically assigns the key a default security descriptor.
<dt><em>phkResult</em>
<dd>[out] Pointer to a variable that receives a handle to the opened or created key. When you no longer need the returned handle, call the <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregclosekey.htm"><u><font color=#0000ff>RegCloseKey</font></u></a> function to close it.
<dt><em>lpdwDisposition</em>
<dd>[out] Pointer to a variable that receives disposition values. The following table shows possible values for this parameter.
<div class=tablediv>
<table class=dtTABLE cellSpacing=0>
    <tbody>
        <tr vAlign=top>
            <th width="37%">Value</th>
            <th width="63%">Description</th>
        </tr>
        <tr vAlign=top>
            <td width="37%">REG_CREATED_NEW_KEY</td>
            <td width="63%">The key did not exist and was created.</td>
        </tr>
        <tr vAlign=top>
            <td width="37%">REG_OPENED_EXISTING_KEY</td>
            <td width="63%">The key existed and was simply opened without being changed.</td>
        </tr>
    </tbody>
</table>
</div>
</dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
<h4 class=dtH4>Remarks</h4>
<p>The key that the <strong>RegCreateKeyEx</strong> function creates has no values. An application can use the <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregsetvalueex.htm"><u><font color=#0000ff>RegSetValueEx</font></u></a> function to set key values. </p>
<p>An application can use <strong>RegCreateKeyEx</strong> to temporarily lock a portion of the registry. When the locking process creates a new key, it receives the disposition value REG_CREATED_NEW_KEY, indicating that it owns the lock. Another process attempting to create the same key receives the disposition value REG_OPENED_EXISTING_KEY, indicating that another process already owns the lock. </p>
</h1>
<p class=dtH1>//开打注册表字段<br></p>
<p>This function opens the specified key.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegOpenKeyExRAPI">CeRegOpenKeyEx (RAPI)</mshelp:link>.</p>
<pre class=syntax><strong>LONG</strong> <strong>RegOpenKeyEx( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>, </strong>
<strong>LPCWSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpSubKey</a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href="">ulOptions</a></em><strong>, </strong>
<strong>REGSAM</strong> <em><a class=synParam onclick=showTip(this) href="">samDesired</a></em><strong>, </strong>
<strong>PHKEY</strong> <em><a class=synParam onclick=showTip(this) href="">phkResult</a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or any of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<p>Windows CE does not support the <strong>HKEY_CURRENT_CONFIG</strong>, <strong>HKEY_PERFORMANCE_DATA</strong>, or <strong>HKEY_DYN_DATA</strong> predefined reserved handle values. </p>
<dt><em>lpSubKey</em>
<dd>[in] Pointer to a null-terminated string containing the name of the subkey to open. If this parameter is NULL or a pointer to an empty string, the function will open a new handle to the key identified by the <em>hKey</em> parameter. In this case, the function will not close the handles previously opened.
<dt><em>ulOptions</em>
<dd>[in] Reserved; set to 0.
<dt><em>samDesired</em>
<dd>[in] Not supported; set to 0.
<dt><em>phkResult</em>
<dd>[out] Pointer to a variable that receives a handle to the opened key. When you no longer need the returned handle, call the <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregclosekey.htm">RegCloseKey</a> function to close it. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
<h4 class=dtH4>Remarks</h4>
<p>Unlike the <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregcreatekeyex.htm">RegCreateKeyEx</a> function, the <strong>RegOpenKeyEx</strong> function does not create the specified key if the key does not exist in the registry. </p>
<br>//写入字段值<br>
<p>This function stores data in the value field of an open registry key. It can also set additional value and type information for the specified key.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegSetValueExRAPI">CeRegSetValueEx (RAPI)</mshelp:link>.</p>
<pre class=syntax><strong>LONG</strong> <strong>RegSetValueEx( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>, </strong>
<strong>LPCWSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpValueName</a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href="">Reserved</a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href="">dwType</a></em><strong>, </strong>
<strong>const</strong> <strong>BYTE* </strong><em><a class=synParam onclick=showTip(this) href="">lpData</a></em><strong>, </strong>
<strong>DWORD</strong> <em><a class=synParam onclick=showTip(this) href="">cbData</a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or any of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<dt><em>lpValueName</em>
<dd>[in] Pointer to a string containing the name of the value to set. If a value with this name is not already present in the key, the function adds it to the key. If this parameter is NULL or an empty string, the function sets the type and data for the key's unnamed value. Registry keys do not have default values, but they can have one unnamed value, which can be of any type. The maximum length of a value name is 255, not including the terminating NULL character.
<dt><em>Reserved</em>
<dd>[in] Reserved; must be zero.
<dt><em>dwType</em>
<dd>[in] Type of information to be stored as the value's data. The following table shows the possible values for <em>dwType</em>.
<div class=tablediv>
<table class=dtTABLE cellSpacing=0>
    <tbody>
        <tr vAlign=top>
            <th width="39%">Value</th>
            <th width="61%">Description</th>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_BINARY</td>
            <td width="61%">Specifies binary data in any form.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_DWORD</td>
            <td width="61%">Specifies a 32-bit number.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_DWORD_LITTLE_ENDIAN</td>
            <td width="61%">Specifies a 32-bit number in little-endian format. This is equivalent to REG_DWORD.
            <p>In little-endian format, a multi-byte value is stored in memory from the lowest byte (the little end) to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format.</p>
            </td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_DWORD_BIG_ENDIAN</td>
            <td width="61%">Specifies a 32-bit number in big-endian format.
            <p>In big-endian format, a multi-byte value is stored in memory from the highest byte (the big end) to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format.</p>
            </td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_EXPAND_SZ</td>
            <td width="61%">Specifies a null-terminated string that contains unexpanded references to environment variables (for example, %PATH%).</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_LINK</td>
            <td width="61%">Specifies a Unicode symbolic link. Used internally; applications should not use this type.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_MULTI_SZ</td>
            <td width="61%">Specifies an array of null-terminated strings, terminated by two null characters.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_NONE</td>
            <td width="61%">No defined value type.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_RESOURCE_LIST</td>
            <td width="61%">Specifies a device-driver resource list.</td>
        </tr>
        <tr vAlign=top>
            <td width="39%">REG_SZ</td>
            <td width="61%">Specifies a null-terminated Unicode string. Do not use the REG_SZ type to store hard-coded paths to the system root.</td>
        </tr>
    </tbody>
</table>
</div>
<dt><em>lpData</em>
<dd>[in] Pointer to a buffer containing the data to be stored with the specified value name.
<dt><em>cbData</em>
<dd>[in] Size, in bytes, of the information pointed to by the <em>lpData</em> parameter. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, <em>cbData</em> must include the size of the terminating null character. The maximum size of data allowed in Windows CE is 4 KB. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
<h4 class=dtH4>Remarks</h4>
<p>Value lengths are limited by available memory. Long values (more than 2048 bytes) should be stored as files with the filenames stored in the registry. This helps the registry perform efficiently. Application elements such as icons, bitmaps, and executable files should be stored as files and not be placed in the registry. </p>
<p>Windows CE supports only the Unicode version of this function.</p>
<h4 class=dtH4>Windows Mobile Remarks</h4>
<p>If <strong>RegSetValueEx</strong> is used to change a value, but the new value is the same as the previous value, no notification is returned.<br><br><br>//保存字段值<br><br></p>
<p>This function saves the specified key and all of its subkeys and values to a new file. If the specified key is not a predefined ROOT, it backs up to the ROOT of the hKey and saves there. </p>
<pre class=syntax><strong>LONG</strong> <strong>RegSaveKey(</strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>,</strong>
<strong>LPCTSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpFile</a></em><strong>,</strong>
<strong>LPSECURITY_ATTRIBUTES</strong> <em><a class=synParam onclick=showTip(this) href="">lpSecurityAttributes</a></em>
<strong>);</strong></pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Specifies a handle to the key where the save operation is to begin, or any of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS </strong></li>
</ul>
<dt><em>lpFile</em>
<dd>[in] Pointer to a null-terminated string containing the name of the file in which the specified key and subkeys are saved.
<dt><em>lpSecurityAttributes</em>
<dd>[in] Must be NULL. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>If the function succeeds, the return value is ERROR_SUCCESS.</p>
<p>The function may fail with <mshelp:link tabIndex=0 keywords="wce50lrfGetLastError">GetLastError</mshelp:link> returning ERROR_NOT_SUPPORTED because it is not supported on the object store-based registry.</p>
<p>If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.</p>
<h4 class=dtH4>Remarks</h4>
<p>The <strong>RegSaveKey</strong> API is only supported by the hive-based registry. To save and restore data in the object store-based registry, see <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregcopyfile.htm">RegCopyFile</a> and <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregrestorefile.htm">RegRestoreFile</a>.</p>
<p>While you can call <strong>RegSaveKey</strong> with any registry key, in effect it only provides two choices. If it is called with <strong>HKEY_LOCAL_MACHINE</strong>, <strong>HKEY_CLASSES_ROOT</strong>, <strong>HKEY_USERS</strong>, or any key under those roots, it saves a copy of the entire system hive, which includes all keys under these roots. If it is called with <strong>HKEY_CURRENT_USER</strong> or any key under it, it saves a copy of the entire user hive, which includes all keys under <strong>HKEY_CURRENT_USER</strong>.</p>
<p>You can use the file created by <strong>RegSaveKey</strong> in subsequent calls to <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregreplacekey.htm">RegReplaceKey</a> with <strong>HKEY_LOCAL_MACHINE</strong> to restore the system registry hive. To restore a saved user hive, move the file into the user's profile directory while the user is not logged in. Subsequent calls to <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfsetcurrentuser.htm">SetCurrentUser</a> will use the restored hive.</p>
<br>//读取键值<br><br>
<p>This function retrieves the type and data for a specified value name associated with an open registry key.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegQueryValueExRAPI">CeRegQueryValueEx (RAPI)</mshelp:link>.</p>
<pre class=syntax><strong>LONG</strong> <strong>RegQueryValueEx( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>, </strong>
<strong>LPCWSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpValueName</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpReserved</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpType</a></em><strong>, </strong>
<strong>LPBYTE</strong> <em><a class=synParam onclick=showTip(this) href="">lpData</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbData</a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or any of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<dt><em>lpValueName</em>
<dd>[in] Pointer to a string containing the name of the value to query. If this parameter is NULL or an empty string, the function retrieves the type and data for the key's unnamed value. A registry key does not automatically have an unnamed or default value. Unnamed values can be of any type.
<dt><em>lpReserved</em>
<dd>[in] Reserved; set to NULL.
<dt><em>lpType</em>
<dd>[out] Pointer to a variable that receives the type of data associated with the specified value. The following table shows the possible values that <em>lpType</em> can return.
<div class=tablediv>
<table class=dtTABLE cellSpacing=0>
    <tbody>
        <tr vAlign=top>
            <th width="38%">Value</th>
            <th width="62%">Description</th>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_BINARY</td>
            <td width="62%">Specifies a binary data in any form.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_DWORD</td>
            <td width="62%">Specifies a 32-bit number.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_DWORD_LITTLE_ENDIAN</td>
            <td width="62%">Specifies a 32-bit number in little-endian format. This is equivalent to REG_DWORD.
            <p>In little-endian format, a multi-byte value is stored in memory from the lowest byte (the little end) to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format.</p>
            </td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_DWORD_BIG_ENDIAN</td>
            <td width="62%">Specifies a 32-bit number in big-endian format.
            <p>In big-endian format, a multi-byte value is stored in memory from the highest byte (the big end) to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format.</p>
            </td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_EXPAND_SZ</td>
            <td width="62%">Specifies a null-terminated string that contains unexpanded references to environment variables. For example, %PATH%.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_LINK</td>
            <td width="62%">Specifies a Unicode symbolic link. Used internally; applications should not use this type.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_MULTI_SZ</td>
            <td width="62%">Specifies an array of null-terminated strings, terminated by two null characters.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_NONE</td>
            <td width="62%">No defined value type.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_RESOURCE_LIST</td>
            <td width="62%">Specifies a device-driver resource list.</td>
        </tr>
        <tr vAlign=top>
            <td width="38%">REG_SZ</td>
            <td width="62%">Specifies a null-terminated Unicode string.</td>
        </tr>
    </tbody>
</table>
</div>
<p>The <em>lpType</em> parameter can be NULL if the type is not required. </p>
<dt><em>lpData</em>
<dd>[out] Pointer to a buffer that receives the value's data. This parameter can be NULL if the data is not required.
<dt><em>lpcbData</em>
<dd>[in, out] Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the <em>lpData</em> parameter. When the function returns, this variable contains the size of the data copied to <em>lpData</em>.
<p>If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, then <em>lpcbData</em> will also include the size of the terminating null character.
<p>The <em>lpcbData</em> parameter can be NULL only if <em>lpData</em> is NULL.
<p>If the buffer specified by <em>lpData</em> parameter is not large enough to hold the data, the function returns the value ERROR_MORE_DATA, and stores the required buffer size, in bytes, into the variable pointed to by <em>lpcbData</em>.
<p>If <em>lpData</em> is NULL, and <em>lpcbData</em> is non-NULL, the function returns ERROR_SUCCESS, and stores the size of the data, in bytes, in the variable pointed to by <em>lpcbData</em>. This lets an application determine the best way to allocate a buffer for the value's data. </p>
</dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
<h4 class=dtH4>Requirements</h4>
<p><strong>OS Versions:</strong> Windows CE 1.0 and later.<br><strong>Header:</strong> Winreg.h.<br><strong>Link Library:</strong> Coredll.lib.<br><br><br>//获取字段信息<br></p>
<p>This function retrieves information about a specified registry key.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegQueryInfoKeyRAPI">CeRegQueryInfoKey (RAPI)</mshelp:link>.</p>
<pre class=syntax><strong>LONG</strong> <strong>RegQueryInfoKey( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>, </strong>
<strong>LPWSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpClass</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbClass</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpReserved</a></em><strong>, </strong>
<strong>LPDWORD</strong><em><a class=synParam onclick=showTip(this) href="">lpcSubKeys</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbMaxSubKeyLen</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbMaxClassLen</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcValues</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbMaxValueNameLen</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam onclick=showTip(this) href="">lpcbMaxValueLen</a></em><strong>, </strong>
<strong>LPDWORD</strong> <em><a class=synParam style="BACKGROUND: none transparent scroll repeat 0% 0%" onclick=showTip(this) href="">lpcbSecurityDescriptor</a></em><strong>, </strong>
<strong>PFILETIME</strong> <em><a class=synParam onclick=showTip(this) href="">lpftLastWriteTime</a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or any of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<dt><em>lpClass</em>
<dd>[out] Pointer to a buffer that receives the key's class name. This parameter can be NULL.
<dt><em>lpcbClass</em>
<dd>[in, out] Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the <em>lpClass</em> parameter. This size should include the terminating null character. When the function returns, this variable contains the length of the class string stored in the buffer. The count returned does not include the terminating null character. If the buffer is not big enough, the function returns ERROR_MORE_DATA, and the variable contains the size of the string, in characters, without counting the null character.
<p>If <em>lpClass</em> is NULL, <em>lpcbClass</em> can be NULL.
<p>If the <em>lpClass</em> parameter is a valid address, but this parameter is not, the function returns ERROR_INVALID_PARAMETER. </p>
<dt><em>lpReserved</em>
<dd>[in] Reserved; set to NULL.
<dt><em>lpcSubKeys</em>
<dd>[out] Pointer to a variable that receives the number of subkeys contained by the specified key. This parameter can be NULL.
<dt><em>lpcbMaxSubKeyLen</em>
<dd>[out] Pointer to a variable that receives the length, in characters, of the key's subkey with the longest name. The count returned does not include the terminating null character. This parameter can be NULL.
<dt><em>lpcbMaxClassLen</em>
<dd>[out] Pointer to a variable that receives the length, in characters, of the longest string specifying a subkey class. The count returned does not include the terminating null character. This parameter can be NULL.
<dt><em>lpcValues</em>
<dd>[out] Pointer to a variable that receives the number of values associated with the key. This parameter can be NULL.
<dt><em>lpcbMaxValueNameLen</em>
<dd>[out] Pointer to a variable that receives the length, in characters, of the key's longest value name. The count returned does not include the terminating null character. This parameter can be NULL.
<dt><em>lpcbMaxValueLen</em>
<dd>[out] Pointer to a variable that receives the length, in bytes, of the longest data component among the values of the key. This parameter can be NULL.
<dt><em>lpcbSecurityDescriptor</em>
<dd>[in] Not used; set to NULL.
<dt><em>lpftLastWriteTime</em>
<dd>[in] Ignored; set to NULL. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
//安全关闭注册表句柄<br><br>
<p>This function releases the handle of the specified key.</p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegCloseKeyRAPI">CeRegCloseKey (RAPI)</mshelp:link>.</p>
<pre class=syntax><strong>LONG</strong> <strong>RegCloseKey( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a> </em>
<strong>);</strong> </pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to the open key to close. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail. </p>
<h4 class=dtH4>Remarks</h4>
<p>The handle for a specified key should not be used after it has been closed, because it will no longer be valid. Key handles should not be left open any longer than necessary. </p>
<p>The <strong>RegCloseKey</strong> function always writes information to the registry before returning, eliminating the need to flush keys in the Windows CE registry.<br><br><br>删除键值<br></p>
<p>This function recursively deletes all subkeys of a named subkey of a specified registry key. </p>
<p>A remote application interface (RAPI) version of this function exists, and it is called <mshelp:link tabIndex=0 keywords="wce50lrfCeRegDeleteKeyRAPI">CeRegDeleteKey (RAPI)</mshelp:link>. </p>
<pre class=syntax><strong>LONG</strong> <strong>RegDeleteKey( </strong>
<strong>HKEY</strong> <em><a class=synParam onclick=showTip(this) href="">hKey</a></em><strong>, </strong>
<strong>LPCWSTR</strong> <em><a class=synParam onclick=showTip(this) href="">lpSubKey</a> </em>
<strong>);</strong></pre>
<h4 class=dtH4>Parameters</h4>
<dl>
<dt><em>hKey</em>
<dd>[in] Handle to a currently open key or one of the following predefined reserved handle values:
<ul type=disc>
    <li><strong>HKEY_CLASSES_ROOT</strong>
    <li><strong>HKEY_CURRENT_USER</strong>
    <li><strong>HKEY_LOCAL_MACHINE</strong>
    <li><strong>HKEY_USERS</strong> </li>
</ul>
<p>The key specified by the <em>lpSubKey</em> parameter must be a subkey of the key identified by <em>hKey</em>. </p>
<dt><em>lpSubKey</em>
<dd>[in] Pointer to a null-terminated string specifying the name of the key to delete. This parameter cannot be NULL. </dd></dl>
<h4 class=dtH4>Return Values</h4>
<p>ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call <mshelp:link tabIndex=0 keywords="wce50lrfFormatMessage">FormatMessage</mshelp:link> with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call <strong>FormatMessage</strong> it could fail.</p>
<h4 class=dtH4>Remarks</h4>
<p>If the function succeeds, <strong>RegDeleteKey</strong> removes the specified key from the registry. The entire key, including all of its values, is removed. An application cannot call <strong>RegDeleteKey</strong> for a key that an application currently has open.</p>
<p>To open the key, use the <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregcreatekeyex.htm">RegCreateKeyEx</a> or <a href="ms-help://MS.MSDNQTR.v90.chs/wcedata5/html/wce50lrfregopenkeyex.htm">RegOpenKeyEx</a> function. </p>
<p><br></p>
<img src ="http://www.cppblog.com/platox/aggbug/124168.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-08-21 12:00 <a href="http://www.cppblog.com/platox/archive/2010/08/21/124168.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WINCE ini文件读取</title><link>http://www.cppblog.com/platox/archive/2010/08/20/124079.html</link><dc:creator>Platox</dc:creator><author>Platox</author><pubDate>Fri, 20 Aug 2010 04:48:00 GMT</pubDate><guid>http://www.cppblog.com/platox/archive/2010/08/20/124079.html</guid><wfw:comment>http://www.cppblog.com/platox/comments/124079.html</wfw:comment><comments>http://www.cppblog.com/platox/archive/2010/08/20/124079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/platox/comments/commentRss/124079.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/platox/services/trackbacks/124079.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;1昨天花了一些时间写了一个WINCE下的INI文件读取，功能很简单啦。。就是去注释，&nbsp;找出索引和关键字&nbsp;放在一个3维的字符串数组里。。&nbsp;&nbsp;2char&nbsp;mmap[1][2][3]。。研究好半天最后一个[3]是字符的个数。[1]是行，[2]是列。。&nbsp;&nbsp;3WINCE是支持UNICODE。。暂时只写了ANSI的。...&nbsp;&nbsp;<a href='http://www.cppblog.com/platox/archive/2010/08/20/124079.html'>阅读全文</a><img src ="http://www.cppblog.com/platox/aggbug/124079.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/platox/" target="_blank">Platox</a> 2010-08-20 12:48 <a href="http://www.cppblog.com/platox/archive/2010/08/20/124079.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>