如何在Win7上设置注册表值? [英] how to set registry value on win7?

查看:129
本文介绍了如何在Win7上设置注册表值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有
我试图使用C ++更改win7上的某些注册表值,而我的代码如下所示:

all
I was trying to change some registry value on win7 using C++, and my code looks like this:

CRegKey cKey;
if(ERROR_SUCCESS == cKey.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.htm\\UserChoice"), KEY_READ))
	cout << "opened!" << endl;
if(ERROR_SUCCESS == cKey.SetStringValue(_T("Progid"), _T("110"), REG_SZ))
	cout << "setted" << endl;


当然,我将清单文件的级别更改为"requireAdministrator".
但是,当我运行该程序时,我只能看到已打开"消息.这意味着我只能打开注册表,而不能设置该值.
有时,当我尝试手动设置一些注册表值时,系统总是说一个或多个应用程序现在可以使用它",而我无法更改该值.
有人可以告诉我如何更改项目中的注册表值吗?
与UAC级别有关吗?
在上例中,您的任何答案都会受到赞赏


And of course I change the manifest file''s level to "requireAdministrator".
But when I run this program, I can only see the "opened" message. It means that I can only open the registry, but cannot set the value.
Sometimes when I try to set some registry value manually, the system always said that "one or more applications may now use it" and I can''t change the value.
Can someone please tell me how I can change the registry value in my project?
Is it something about the UAC level?
Any answers from you will be appreciated

推荐答案

,您只是在请求
KEY_READ

访问权限,而该访问权限仅授予您对句柄的READ访问回来

尝试

access, which only gives you READ access to the handle you get back

try

KEY_ALL_ACCESS


如果您使用的是Google,则可能会找到一些方法.
If you Google it, you might find some ways to do it.


这篇关于如何在Win7上设置注册表值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆