删除注册表项值

编程入门 行业动态 更新时间:2024-10-27 10:22:01
本文介绍了删除注册表项值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在MSDN中,它说在调用更改枚举的注册表项的函数时不应使用RegEnumValue。

In MSDN it says that RegEnumValue should not be used when calling function that change the registry keys being enumerated.

那么这是否也适用于删除注册表项值?

So does this also apply to deleting registry key values?

就像下面的代码一样:

if (RegOpenKeyEx(m_hkey,m_path.c_str(),0,KEY_ALL_ACCESS,&key) == ERROR_SUCCESS) { bool error=false; idx=0; while (RegEnumValue(key,idx,name,&namesize,NULL,NULL,NULL,NULL) == ERROR_SUCCESS && !error) { error=(RegDeleteValue(key,name)!=ERROR_SUCCESS); idx++; } RegCloseKey(key); }

推荐答案

您的代码不起作用。当您删除索引0时,下一项将变为索引0,并且您不会将其删除。

Your code does not work. When you delete index 0, the next item becomes index 0, and you do not delete that.

因此,它适用于删除键值。

So yes, it applies to deleting key values.

更多推荐

删除注册表项值

本文发布于:2023-11-03 14:33:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555371.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注册表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!