注册表操作函数问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 02:44:26
1.LONG RegCreateKeyEx( HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved,
LPTSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult, LPDWORD lpdwDisposition );
这个函数的第4个参数lpClassMSDN上的解释为:
Pointer to a null-terminated string that specifies the class (object type) of this key. This parameter is ignored if the key already exists(原文)
一个指向包含键类型的字符串。如果该键已经存在,则忽略该参数; (翻译).
我想知道这个参数的作用是什么在什么情况下会用到,很多操作注册表的函数都会用这个参数,我想知道它的作用.最好有例子说明.
2.我想用Regqueryvalueex 和Regsetvalueex两个函数分别查询一个项下面的默认值,请给出具体的例子,附上说明当然更好!
3.我在用RegEnumvalue函数的时候总是不能遍历子项下的所有数据,只能找到部分而且有几个重复,如何遍历一个项下的所有数据成员呢?请给出具体的例子.

//使用ATL中的CRegKey

CRegKey key;
if(key.Create(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\TestReg"))==ERROR_SUCCESS)
{
key.SetValue("test","default");
key.Close();
}

对不起,我不知道..希望你能找到答案.