﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Timothy&#039;s Space &#187; registry</title>
	<atom:link href="http://www.xiaozhou.net/tag/registry/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xiaozhou.net</link>
	<description>君看一叶舟，出没风波里</description>
	<lastBuildDate>Tue, 07 Feb 2012 04:28:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>修改注册表开机自动启动程序</title>
		<link>http://www.xiaozhou.net/vcdevelopment/modify-the-registry-at-boot-program-is-started-automatically-2004-12-24.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/modify-the-registry-at-boot-program-is-started-automatically-2004-12-24.htm#comments</comments>
		<pubDate>Fri, 24 Dec 2004 08:41:06 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[autorun]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[modify]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[启动]]></category>
		<category><![CDATA[注册表]]></category>
		<category><![CDATA[程序]]></category>
		<category><![CDATA[自动]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=54</guid>
		<description><![CDATA[HKEY hKey; char szFileName[256]; GetModuleFileName(NULL,szFileName,256); RegOpenKey(HKEY_LOCAL_MACHINE,&#8221;SOFTWARE\\Microsoft\\windows\\currentversion\\run&#8221;,&#038;hKey); if(m_bAutoRun) { RegSetValueEx(hKey,&#8221;RunmeAtStartup&#8221;,0,REG_SZ,(BYTE *)szFileName,sizeof(szFileName)); } else { RegDeleteValue(hKey,&#8221;RunmeAtStartup&#8221;); } RegCloseKey(hKey); 声明: 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 本站文章均采用 知识共享署名-相同方式共享3.0 协议进行授权，除非注明，本站文章均为原创，转载请注明转自 Timothy&#039;s Space 并应以链接形式标明本文地址!]]></description>
			<content:encoded><![CDATA[<p>HKEY	hKey;<br />
char	szFileName[256];<br />
GetModuleFileName(NULL,szFileName,256);<br />
RegOpenKey(HKEY_LOCAL_MACHINE,&#8221;SOFTWARE\\Microsoft\\windows\\currentversion\\run&#8221;,&#038;hKey);<br />
if(m_bAutoRun)<br />
{<br />
	RegSetValueEx(hKey,&#8221;RunmeAtStartup&#8221;,0,REG_SZ,(BYTE *)szFileName,sizeof(szFileName));<br />
}<br />
else<br />
{<br />
	RegDeleteValue(hKey,&#8221;RunmeAtStartup&#8221;);<br />
}<br />
RegCloseKey(hKey);</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/modify-the-registry-at-boot-program-is-started-automatically-2004-12-24.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>枚举注册表键名与键值</title>
		<link>http://www.xiaozhou.net/vcdevelopment/enumerate-the-registry-key-name-and-key-value-2004-10-21.htm</link>
		<comments>http://www.xiaozhou.net/vcdevelopment/enumerate-the-registry-key-name-and-key-value-2004-10-21.htm#comments</comments>
		<pubDate>Thu, 21 Oct 2004 07:22:35 +0000</pubDate>
		<dc:creator>Timothy</dc:creator>
				<category><![CDATA[VC开发]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[value]]></category>
		<category><![CDATA[枚举]]></category>
		<category><![CDATA[注册表]]></category>
		<category><![CDATA[键值]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=32</guid>
		<description><![CDATA[枚举注册表键名与键值的一个函数： // QueryKey &#8211; Enumerates the subkeys of key, and the associated // values, then copies the information about the keys and values // into a pair of edit controls and list boxes. // hDlg &#8211; Dialog box that contains the edit controls and list boxes. // hKey &#8211; Key whose subkeys and values are [...]]]></description>
			<content:encoded><![CDATA[<p>枚举注册表键名与键值的一个函数：</p>
<p>// QueryKey &#8211; Enumerates the subkeys of key, and the associated<br />
//    values, then copies the information about the keys and values<br />
//    into a pair of edit controls and list boxes.<br />
// hDlg &#8211; Dialog box that contains the edit controls and list boxes.<br />
// hKey &#8211; Key whose subkeys and values are to be enumerated.</p>
<p>void QueryKey(HWND hDlg, HANDLE hKey)<br />
{<br />
    CHAR     achKey[MAX_PATH];<br />
    CHAR     achClass[MAX_PATH] = &#8220;&#8221;;  // buffer for class name<br />
    DWORD    cchClassName = MAX_PATH;  // size of class string<br />
    DWORD    cSubKeys;                 // number of subkeys<br />
    DWORD    cbMaxSubKey;              // longest subkey size<br />
    DWORD    cchMaxClass;              // longest class string<br />
    DWORD    cValues;              // number of values for key<br />
    DWORD    cchMaxValue;          // longest value name<br />
    DWORD    cbMaxValueData;       // longest value data<br />
    DWORD    cbSecurityDescriptor; // size of security descriptor<br />
    FILETIME ftLastWriteTime;      // last write time</p>
<p>    DWORD i, j;<br />
    DWORD retCode, retValue;</p>
<p>    CHAR  achValue[MAX_VALUE_NAME];<br />
    DWORD cchValue = MAX_VALUE_NAME;<br />
    CHAR  achBuff[80];</p>
<p>    // Get the class name and the value count.<br />
    RegQueryInfoKey(hKey,        // key handle<br />
        achClass,                // buffer for class name<br />
        &#038;cchClassName,           // size of class string<br />
        NULL,                    // reserved<br />
        &#038;cSubKeys,               // number of subkeys<br />
        &#038;cbMaxSubKey,            // longest subkey size<br />
        &#038;cchMaxClass,            // longest class string<br />
        &#038;cValues,                // number of values for this key<br />
        &#038;cchMaxValue,            // longest value name<br />
        &#038;cbMaxValueData,         // longest value data<br />
        &#038;cbSecurityDescriptor,   // security descriptor<br />
        &#038;ftLastWriteTime);       // last write time</p>
<p>    SetDlgItemText(hDlg, IDE_CLASS, achClass);<br />
    SetDlgItemInt(hDlg, IDE_CVALUES, cValues, FALSE);</p>
<p>    SendMessage(GetDlgItem(hDlg, IDL_LISTBOX),<br />
        LB_ADDSTRING, 0, (LONG) &#8220;..&#8221;);</p>
<p>    // Enumerate the child keys, until RegEnumKeyEx fails. Then<br />
    // get the name of each child key and copy it into the list box.</p>
<p>    SetCursor(LoadCursor(NULL, IDC_WAIT));<br />
    for (i = 0, retCode = ERROR_SUCCESS;<br />
            retCode == ERROR_SUCCESS; i++)<br />
    {<br />
        retCode = RegEnumKeyEx(hKey,<br />
                     i,<br />
                     achKey,<br />
                     MAX_PATH,<br />
                     NULL,<br />
                     NULL,<br />
                     NULL,<br />
                     &#038;ftLastWriteTime);<br />
        if (retCode == (DWORD)ERROR_SUCCESS)<br />
        {<br />
            SendMessage(GetDlgItem(hDlg, IDL_LISTBOX),<br />
                LB_ADDSTRING, 0, (LONG) achKey);<br />
        }<br />
    }<br />
    SetCursor(LoadCursor (NULL, IDC_ARROW));</p>
<p>    // Enumerate the key values.<br />
    SetCursor(LoadCursor(NULL, IDC_WAIT));</p>
<p>    if (cValues)<br />
    {<br />
        for (j = 0, retValue = ERROR_SUCCESS;<br />
                j < cValues; j++)<br />
        {<br />
            cchValue = MAX_VALUE_NAME;<br />
            achValue[0] = '\0';<br />
            retValue = RegEnumValue(hKey, j, achValue,<br />
                &#038;cchValue,<br />
                NULL,<br />
                NULL,    // &#038;dwType,<br />
                NULL,    // &#038;bData,<br />
                NULL);   // &#038;bcData</p>
<p>            if (retValue == (DWORD) ERROR_SUCCESS )<br />
            {<br />
                achBuff[0] = '\0';</p>
<p>                // Add each value to a list box.<br />
                if (!lstrlen(achValue))<br />
                    lstrcpy(achValue, "<no NAME>&#8220;);<br />
                wsprintf(achBuff, &#8220;%d) %s &#8220;, j, achValue);<br />
                SendMessage(GetDlgItem(hDlg,IDL_LISTBOX2),<br />
                    LB_ADDSTRING, 0, (LONG) achBuff);<br />
            }<br />
        }</p>
<p>    SetCursor(LoadCursor(NULL, IDC_ARROW));<br />
}</p>
<p class="announce"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;">声明:</span> 此Blog中的文章和随笔仅代表作者在某一特定时间内的观点和结论，对其完全的正确不做任何担保或假设 <br /> 本站文章均采用 <a rel="nofollow" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" title="署名-非商业性使用-相同方式共享">知识共享署名-相同方式共享3.0</a> 协议进行授权，除非注明，本站文章均为原创，转载请注明转自  <a href="http://www.xiaozhou.net">Timothy&#039;s Space</a> 并应以链接形式标明本文地址!</p>]]></content:encoded>
			<wfw:commentRss>http://www.xiaozhou.net/vcdevelopment/enumerate-the-registry-key-name-and-key-value-2004-10-21.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

